summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2011-06-06 21:25:38 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2011-06-06 21:25:38 +0000
commit1ec454197a94b693b67f8b9d8bb702288b1478fe (patch)
tree9010ee023db94a28dde5ac5f5d5edaa5e38beb58 /hlsl
parent1d33744bd45f67fd1bd6f1a71aaa42db5d49a138 (diff)
HLSL Updates: [Ryan Holtz, Bat Country Entertainment, austere]
- Reworked default shadow mask settings, eliminating rainbow banding and matching reference shots more closely - Moved color power to occur after shadow mask, as it is intended to simulate nonlinear phosphor response - Added a variable-width notch filter to the Y channel in NTSC post-processing, eliminating luma banding on e.g. CoCo 2 and Apple II
Diffstat (limited to 'hlsl')
-rw-r--r--hlsl/color.fx8
-rw-r--r--hlsl/post.fx10
-rw-r--r--hlsl/yiq_decode.fx22
3 files changed, 24 insertions, 16 deletions
diff --git a/hlsl/color.fx b/hlsl/color.fx
index e4aa954e8b5..e7ceeb57978 100644
--- a/hlsl/color.fx
+++ b/hlsl/color.fx
@@ -100,10 +100,6 @@ uniform float BluFloor = 0.0f;
uniform float Saturation = 1.0f;
-uniform float RedPower = 2.2f;
-uniform float GrnPower = 2.2f;
-uniform float BluPower = 2.2f;
-
float4 ps_main(PS_INPUT Input) : COLOR
{
float4 BaseTexel = tex2D(DiffuseSampler, Input.TexCoord);
@@ -126,10 +122,6 @@ float4 ps_main(PS_INPUT Input) : COLOR
float3 OutChroma = OutTexel - OutLuma;
float3 Saturated = OutLuma + OutChroma * Saturation;
- OutRGB.r = pow(Saturated.r, RedPower);
- OutRGB.g = pow(Saturated.g, GrnPower);
- OutRGB.b = pow(Saturated.b, BluPower);
-
return float4(OutRGB, BaseTexel.a);
}
diff --git a/hlsl/post.fx b/hlsl/post.fx
index 6a148637805..eee6aaa4798 100644
--- a/hlsl/post.fx
+++ b/hlsl/post.fx
@@ -119,6 +119,10 @@ uniform float BluFloor = 0.0f;
uniform float SnapX = 0.0f;
uniform float SnapY = 0.0f;
+uniform float RedPower = 2.2f;
+uniform float GrnPower = 2.2f;
+uniform float BluPower = 2.2f;
+
float4 ps_main(PS_INPUT Input) : COLOR
{
float2 Ratios = float2(WidthRatio, HeightRatio);
@@ -174,13 +178,17 @@ float4 ps_main(PS_INPUT Input) : COLOR
float2 ShadowDims = float2(ShadowWidth, ShadowHeight);
float2 ShadowUV = float2(ShadowU, ShadowV);
float2 ShadowMaskSize = float2(ShadowMaskSizeX, ShadowMaskSizeY);
- float2 ShadowFrac = frac(BaseCoord * ShadowMaskSize * 0.5f);
+ float2 ShadowFrac = frac(BaseCoord * ShadowMaskSize);
float2 ShadowCoord = ShadowFrac * ShadowUV + float2(1.5f / ShadowWidth, 1.5f / ShadowHeight);
float3 ShadowTexel = lerp(1.0f, tex2D(ShadowSampler, ShadowCoord).rgb, UseShadow);
// -- Final Pixel --
float4 Output = float4(Scanned * lerp(1.0f, ShadowTexel, ShadowBrightness), BaseTexel.a) * Input.Color;
+ Output.r = pow(Output.r, RedPower);
+ Output.g = pow(Output.g, GrnPower);
+ Output.b = pow(Output.b, BluPower);
+
return Output;
}
diff --git a/hlsl/yiq_decode.fx b/hlsl/yiq_decode.fx
index 61ba590717a..c94ae76de0d 100644
--- a/hlsl/yiq_decode.fx
+++ b/hlsl/yiq_decode.fx
@@ -91,7 +91,8 @@ uniform float PValue = 1.0f;
uniform float OValue = 0.0f;
uniform float ScanTime = 52.6f;
-uniform float YFreqResponse = 3.0f;
+uniform float NotchHalfWidth = 1.0f;
+uniform float YFreqResponse = 6.0f;
uniform float IFreqResponse = 1.2f;
uniform float QFreqResponse = 0.6f;
@@ -108,15 +109,17 @@ float4 ps_main(PS_INPUT Input) : COLOR
float MaxC = 2.1183f;
float MinC = -1.1183f;
float CRange = MaxC - MinC;
- float Fc_y = YFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
+ float Fc_y1 = (CCValue - NotchHalfWidth) * ScanTime / (RawWidth * 4.0f / WidthRatio);
+ float Fc_y2 = (CCValue + NotchHalfWidth) * ScanTime / (RawWidth * 4.0f / WidthRatio);
+ float Fc_y3 = YFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
float Fc_i = IFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
float Fc_q = QFreqResponse * ScanTime / (RawWidth * 4.0f / WidthRatio);
float PI = 3.1415926535897932384626433832795;
float PI2 = 2.0f * PI;
- float PI2Length = PI2 / 42.0f;
+ float PI2Length = PI2 / 82.0f;
float4 NOffset = float4(0.0f, 1.0f, 2.0f, 3.0f);
float W = PI2 * CCValue * ScanTime;
- for(float n = -21.0f; n < 22.0f; n += 4.0f)
+ for(float n = -41.0f; n < 42.0f; n += 4.0f)
{
float4 n4 = n + NOffset;
float4 CoordX = Input.Coord0.x + Input.Coord0.z * n4 * 0.25f;
@@ -125,9 +128,14 @@ float4 ps_main(PS_INPUT Input) : COLOR
float4 C = tex2D(CompositeSampler, TexCoord + float2(0.625f, 0.4f) / RawDims) * CRange + MinC;
float4 WT = W * (CoordX * WidthRatio + AValue * CoordY * 2.0f * (RawHeight / HeightRatio) + BValue) + OValue;
- float4 SincYIn = PI2 * Fc_y * n4;
- float4 IdealY = 2.0f * Fc_y * ((SincYIn != 0.0f) ? (sin(SincYIn) / SincYIn) : 1.0f);
- float4 FilterY = (0.54f + 0.46f * cos(PI2Length * n4)) * IdealY;
+ float4 SincYIn1 = PI2 * Fc_y1 * n4;
+ float4 SincYIn2 = PI2 * Fc_y2 * n4;
+ float4 SincYIn3 = PI2 * Fc_y3 * n4;
+ float4 SincY1 = ((SincYIn1 != 0.0f) ? (sin(SincYIn1) / SincYIn1) : 1.0f);
+ float4 SincY2 = ((SincYIn2 != 0.0f) ? (sin(SincYIn2) / SincYIn2) : 1.0f);
+ float4 SincY3 = ((SincYIn3 != 0.0f) ? (sin(SincYIn3) / SincYIn3) : 1.0f);
+ float4 IdealY = (2.0f * Fc_y1 * SincY1 - 2.0f * Fc_y2 * SincY2) + 2.0f * Fc_y3 * SincY3;
+ float4 FilterY = (0.54f + 0.46f * cos(PI2Length * n4)) * IdealY;
float4 SincIIn = PI2 * Fc_i * n4;
float4 IdealI = 2.0f * Fc_i * ((SincIIn != 0.0f) ? (sin(SincIIn) / SincIIn) : 1.0f);