summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/artwork_support/post.fx
diff options
context:
space:
mode:
Diffstat (limited to 'hlsl/artwork_support/post.fx')
-rw-r--r--hlsl/artwork_support/post.fx30
1 files changed, 22 insertions, 8 deletions
diff --git a/hlsl/artwork_support/post.fx b/hlsl/artwork_support/post.fx
index 8da6dabf1ab..f0c883fa69e 100644
--- a/hlsl/artwork_support/post.fx
+++ b/hlsl/artwork_support/post.fx
@@ -151,6 +151,11 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Scanline, Shadowmask & Distortion Pixel Shader
//-----------------------------------------------------------------------------
+uniform float HumBarHertzRate = 60.0f / 59.94f - 1.0f; // difference between the 59.94 Hz field rate and 60 Hz line frequency (NTSC)
+uniform float HumBarAlpha = 0.0f;
+
+uniform float TimeMilliseconds = 0.0f;
+
uniform float2 ScreenScale = float2(1.0f, 1.0f);
uniform float2 ScreenOffset = float2(0.0f, 0.0f);
@@ -396,7 +401,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
}
// Mask Simulation (may not affect bloom)
- if (!PrepareBloom)
+ if (!PrepareBloom && ShadowAlpha > 0.0f)
{
float2 shadowDims = ShadowDims;
shadowDims = SwapXY
@@ -455,15 +460,24 @@ float4 ps_main(PS_INPUT Input) : COLOR
// Scanline Simulation (may not affect bloom)
if (!PrepareBloom)
{
- // Scanline Simulation (disabled for vector)
- if (!PrepareVector)
+ // Scanline Simulation (may not affect vector screen)
+ if (!PrepareVector && ScanlineAlpha > 0.0f)
{
- float InnerSine = BaseCoord.y * ScanlineScale * SourceDims.y;
- float ScanJitter = ScanlineOffset * SourceDims.y;
- float ScanBrightMod = sin(InnerSine * PI + ScanJitter);
- float3 ScanColor = lerp(1.0f, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0f + ScanlineBrightOffset) * 0.5f, ScanlineAlpha);
+ float ScanCoord = BaseCoord.y * SourceDims.y * ScanlineScale * PI;
+ float ScanCoordJitter = ScanlineOffset * PHI;
+ float ScanSine = sin(ScanCoord + ScanCoordJitter);
+ float ScanSineScaled = pow(ScanSine * ScanSine, ScanlineHeight);
+ float ScanBrightness = ScanSineScaled * ScanlineBrightScale + 1.0f + ScanlineBrightOffset;
- BaseColor.rgb *= ScanColor;
+ BaseColor.rgb *= lerp(1.0f, ScanBrightness * 0.5f, ScanlineAlpha);
+ }
+
+ // Hum Bar Simulation (may not affect vector screen)
+ if (!PrepareVector && HumBarAlpha > 0.0f)
+ {
+ float HumTimeStep = frac(TimeMilliseconds * HumBarHertzRate);
+ float HumBrightness = 1.0 - frac(BaseCoord.y / SourceRect.y + HumTimeStep) * HumBarAlpha;
+ BaseColor.rgb *= HumBrightness;
}
}