summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/color.fx
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2015-12-25 20:02:47 +0100
committer ImJezze <jezze@gmx.net>2015-12-25 20:02:47 +0100
commit1b373eb812d11dfeb0fead627f7df4e827e27f8f (patch)
treea99b38395c8ba5a6706c9340bf9b3cb9430de571 /hlsl/color.fx
parent099f547d05856238f5879803c794ea3a233c5d55 (diff)
Extended Shadow Mask and Bloom functionality
- added shadow mask type option to choose between "Screen" and "Source" tile mode ("Screen" is the default as before) - added bloom type option to choose between "Addition" and "Darken" blend mode ("Addition" is the default as before) - the alpha channel of a shadow mask is now filled with the background color of the screen by the amount of the inverted alpha value - added monochrome-matrix.png which can be used in combination with "Source" tile mode and "Darken" blend mode to simulate a STN LCD, for example
Diffstat (limited to 'hlsl/color.fx')
-rw-r--r--hlsl/color.fx26
1 files changed, 13 insertions, 13 deletions
diff --git a/hlsl/color.fx b/hlsl/color.fx
index 53404726699..7724eeb10f7 100644
--- a/hlsl/color.fx
+++ b/hlsl/color.fx
@@ -49,20 +49,20 @@ struct PS_INPUT
uniform float2 ScreenDims;
uniform float2 SourceDims;
-uniform float YIQEnable;
-
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
-
- float2 invDims = 1.0f / SourceDims;
+
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
- Output.Position.y = 1.0f - Output.Position.y;
- Output.Position.xy -= 0.5f;
- Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
+ Output.Position.y = 1.0f - Output.Position.y; // flip y
+ Output.Position.xy -= 0.5f; // center
+ Output.Position.xy *= 2.0f; // zoom
+
+ Output.TexCoord = Input.TexCoord;
+ Output.TexCoord += 0.5f / SourceDims; // half texel offset correction (DX9)
+
Output.Color = Input.Color;
- Output.TexCoord = Input.TexCoord + 0.5f * invDims;
return Output;
}
@@ -84,17 +84,17 @@ float4 ps_main(PS_INPUT Input) : COLOR
float3 OutRGB = BaseTexel.rgb;
- // -- RGB Tint & Shift --
+ // RGB Tint & Shift
float ShiftedRed = dot(OutRGB, RedRatios);
float ShiftedGrn = dot(OutRGB, GrnRatios);
float ShiftedBlu = dot(OutRGB, BluRatios);
- // -- RGB Offset & Scale --
+ // RGB Scale & Offset
float3 OutTexel = float3(ShiftedRed, ShiftedGrn, ShiftedBlu) * Scale + Offset;
- // -- Saturation --
- float3 Gray = float3(0.3f, 0.59f, 0.11f);
- float OutLuma = dot(OutTexel, Gray);
+ // Saturation
+ float3 Grayscale = float3(0.299f, 0.587f, 0.114f);
+ float OutLuma = dot(OutTexel, Grayscale);
float3 OutChroma = OutTexel - OutLuma;
float3 Saturated = OutLuma + OutChroma * Saturation;