mirror of
https://github.com/holub/mame
synced 2025-06-30 16:00:01 +03:00
Changed vignetting simulation
- removed screen ratio influence - changed radius, blur and intensity
This commit is contained in:
parent
578f8b5bbe
commit
0fa1503782
28
hlsl/post.fx
28
hlsl/post.fx
@ -173,14 +173,12 @@ float GetVignetteFactor(float2 coord, float amount)
|
|||||||
{
|
{
|
||||||
float2 VignetteCoord = coord;
|
float2 VignetteCoord = coord;
|
||||||
|
|
||||||
float VignetteBlur = amount * 2.0f;
|
float VignetteLength = length(VignetteCoord);
|
||||||
|
float VignetteBlur = (amount * 0.75f) + 0.25;
|
||||||
|
|
||||||
// 0.5 full screen fitting circle
|
// 0.5 full screen fitting circle
|
||||||
float VignetteRadius = 1.0f - amount * 0.5f;
|
float VignetteRadius = 1.0f - (amount * 0.25f);
|
||||||
float Vignette = smoothstep(VignetteRadius, VignetteRadius - VignetteBlur, length(VignetteCoord));
|
float Vignette = smoothstep(VignetteRadius, VignetteRadius - VignetteBlur, VignetteLength);
|
||||||
|
|
||||||
// reduce strength to 50%
|
|
||||||
Vignette = lerp(1.0, 1.0 * Vignette, 0.5f);
|
|
||||||
|
|
||||||
return saturate(Vignette);
|
return saturate(Vignette);
|
||||||
}
|
}
|
||||||
@ -283,18 +281,18 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
|||||||
BaseCoordCentered *= CurvatureZoom; // zoom
|
BaseCoordCentered *= CurvatureZoom; // zoom
|
||||||
BaseCoordCentered += CurvatureCurve; // distortion
|
BaseCoordCentered += CurvatureCurve; // distortion
|
||||||
|
|
||||||
// float2 BaseAreaRatioCoord = BaseCoord;
|
float2 BaseAreaCoord = BaseCoord;
|
||||||
// BaseAreaRatioCoord *= UsedArea * ScreenRatio;
|
BaseAreaCoord *= UsedArea;
|
||||||
|
|
||||||
float2 BaseAreaRatioCoordCentered = BaseCoordCentered;
|
|
||||||
BaseAreaRatioCoordCentered *= UsedArea * ScreenRatio;
|
|
||||||
|
|
||||||
// float2 BaseAreaCoord = BaseCoord;
|
|
||||||
// BaseAreaCoord *= UsedArea;
|
|
||||||
|
|
||||||
float2 BaseAreaCoordCentered = BaseCoordCentered;
|
float2 BaseAreaCoordCentered = BaseCoordCentered;
|
||||||
BaseAreaCoordCentered *= UsedArea;
|
BaseAreaCoordCentered *= UsedArea;
|
||||||
|
|
||||||
|
float2 BaseAreaRatioCoord = BaseAreaCoord;
|
||||||
|
BaseAreaRatioCoord *= ScreenRatio;
|
||||||
|
|
||||||
|
float2 BaseAreaRatioCoordCentered = BaseAreaCoordCentered;
|
||||||
|
BaseAreaRatioCoordCentered *= ScreenRatio;
|
||||||
|
|
||||||
// // Alpha Clipping (round corners applies smoother clipping when screen is curved)
|
// // Alpha Clipping (round corners applies smoother clipping when screen is curved)
|
||||||
// clip((BaseCoord < SourceTexelDims) ? -1 : 1);
|
// clip((BaseCoord < SourceTexelDims) ? -1 : 1);
|
||||||
// clip((BaseCoord > SourceRect + SourceTexelDims) ? -1 : 1);
|
// clip((BaseCoord > SourceRect + SourceTexelDims) ? -1 : 1);
|
||||||
@ -303,7 +301,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
|||||||
BaseColor.a = 1.0f;
|
BaseColor.a = 1.0f;
|
||||||
|
|
||||||
// Vignetting Simulation (may affect bloom)
|
// Vignetting Simulation (may affect bloom)
|
||||||
float2 VignetteCoord = BaseAreaRatioCoordCentered;
|
float2 VignetteCoord = BaseAreaCoordCentered;
|
||||||
|
|
||||||
float VignetteFactor = GetVignetteFactor(VignetteCoord, VignettingAmount);
|
float VignetteFactor = GetVignetteFactor(VignetteCoord, VignettingAmount);
|
||||||
BaseColor.rgb *= VignetteFactor;
|
BaseColor.rgb *= VignetteFactor;
|
||||||
|
Loading…
Reference in New Issue
Block a user