diff options
author | 2011-05-27 10:07:11 +0000 | |
---|---|---|
committer | 2011-05-27 10:07:11 +0000 | |
commit | c8ef077d5ba989d07f17d663b7c8c875d9903604 (patch) | |
tree | 8d15aa6f10b50af574db068c45eae1a1a112628b /hlsl/post.fx | |
parent | 10583a2dfbec2b4fa24f7a2def56b21c87c619fb (diff) |
HLSL Updates: [Ryan Holtz, Bat Country Entertainment]
- Switched to point-sampling through most of the shader chain to avoid non-intentional pixel smearing
- Corrected alignment and scaling on the shadow mask and scanlines; dramatically reduces rainbow banding at non-oversampled resolutions.
Diffstat (limited to 'hlsl/post.fx')
-rw-r--r-- | hlsl/post.fx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/hlsl/post.fx b/hlsl/post.fx index c9bd0f79b04..4186e040e47 100644 --- a/hlsl/post.fx +++ b/hlsl/post.fx @@ -154,18 +154,19 @@ float4 ps_main(PS_INPUT Input) : COLOR clip((BaseCoord.y > (1.0f / HeightRatio + 1.0f / RawHeight)) ? -1 : 1); // -- Scanline Simulation -- - float3 ScanBrightness = lerp(1.0f, abs(sin(((BaseCoord.y * Ratios.y * RawHeight * ScanlineScale) * PI + ScanlineOffset * RawHeight))) * ScanlineBrightScale + ScanlineBrightOffset, ScanlineAmount); + float InnerSine = BaseCoord.y * RawHeight * ScanlineScale + 0.5f; + float3 ScanBrightness = lerp(1.0f, sin(InnerSine * PI * 2.0f + ScanlineOffset * RawHeight) * ScanlineBrightScale + 1.0f, ScanlineAmount); float3 Scanned = BaseTexel.rgb * ScanBrightness; float2 ShadowDims = float2(ShadowWidth, ShadowHeight); float2 ShadowUV = float2(ShadowU, ShadowV); float2 ShadowMaskSize = float2(ShadowMaskSizeX, ShadowMaskSizeY); - float2 ShadowFrac = frac(ScreenCurveCoord * ShadowMaskSize * Ratios * 0.5f); + float2 ShadowFrac = frac((ScreenCurveCoord * ShadowMaskSize * 0.5f) / Ratios); float2 ShadowCoord = ShadowFrac * ShadowUV + 1.5f / ShadowDims; float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord), UseShadow); // -- Final Pixel -- - float4 Output = float4(Scanned * lerp(1.0f, ShadowTexel * 1.25f, ShadowBrightness), BaseTexel.a) * Input.Color; + float4 Output = float4(Scanned * lerp(1.0f, ShadowTexel, ShadowBrightness), BaseTexel.a) * Input.Color; return Output; } |