summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2011-05-27 10:07:11 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2011-05-27 10:07:11 +0000
commitc8ef077d5ba989d07f17d663b7c8c875d9903604 (patch)
tree8d15aa6f10b50af574db068c45eae1a1a112628b /hlsl
parent10583a2dfbec2b4fa24f7a2def56b21c87c619fb (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')
-rw-r--r--hlsl/color.fx6
-rw-r--r--hlsl/deconverge.fx6
-rw-r--r--hlsl/phosphor.fx12
-rw-r--r--hlsl/post.fx7
4 files changed, 16 insertions, 15 deletions
diff --git a/hlsl/color.fx b/hlsl/color.fx
index 8b618eb325a..e04d93daabd 100644
--- a/hlsl/color.fx
+++ b/hlsl/color.fx
@@ -7,9 +7,9 @@ texture Diffuse;
sampler DiffuseSampler = sampler_state
{
Texture = <Diffuse>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
+ MipFilter = POINT;
+ MinFilter = POINT;
+ MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
diff --git a/hlsl/deconverge.fx b/hlsl/deconverge.fx
index 1a0ccf79592..74f7be1447f 100644
--- a/hlsl/deconverge.fx
+++ b/hlsl/deconverge.fx
@@ -7,9 +7,9 @@ texture Diffuse;
sampler DiffuseSampler = sampler_state
{
Texture = <Diffuse>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
+ MipFilter = POINT;
+ MinFilter = POINT;
+ MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx
index 6512cc4739a..242c23d26a2 100644
--- a/hlsl/phosphor.fx
+++ b/hlsl/phosphor.fx
@@ -7,9 +7,9 @@ texture Diffuse;
sampler DiffuseSampler = sampler_state
{
Texture = <Diffuse>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
+ MipFilter = POINT;
+ MinFilter = POINT;
+ MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
@@ -20,9 +20,9 @@ texture LastPass;
sampler PreviousSampler = sampler_state
{
Texture = <LastPass>;
- MipFilter = LINEAR;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
+ MipFilter = POINT;
+ MinFilter = POINT;
+ MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
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;
}