summaryrefslogtreecommitdiffstatshomepage
path: root/hlsl/color.fx
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2011-06-11 23:46:24 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2011-06-11 23:46:24 +0000
commit80d66bb1d6dee4f6e0d91ddf415d123b0aace1e2 (patch)
tree257920a2a6ab9e564982ab2e06b83d7f77ec976e /hlsl/color.fx
parent5d2798215c21b68ac84dee11a6f6c7de53cc0ddc (diff)
HLSL Cleanup, no whatsnew:
- Fixed set_vector functionality and simplified shaders as a result - Fixed HLSL presets, 0 to 3, in increasing level of terribleness - Reduced options footprint from RGB triplets Next plan: Separate INI writing.
Diffstat (limited to 'hlsl/color.fx')
-rw-r--r--hlsl/color.fx39
1 files changed, 10 insertions, 29 deletions
diff --git a/hlsl/color.fx b/hlsl/color.fx
index e7ceeb57978..5e62dbd6d9f 100644
--- a/hlsl/color.fx
+++ b/hlsl/color.fx
@@ -76,28 +76,11 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// Post-Processing Pixel Shader
//-----------------------------------------------------------------------------
-uniform float RedFromRed = 1.0f;
-uniform float RedFromGrn = 0.0f;
-uniform float RedFromBlu = 0.0f;
-uniform float GrnFromRed = 0.0f;
-uniform float GrnFromGrn = 1.0f;
-uniform float GrnFromBlu = 0.0f;
-uniform float BluFromRed = 0.0f;
-uniform float BluFromGrn = 0.0f;
-uniform float BluFromBlu = 1.0f;
-
-uniform float RedOffset = 0.0f;
-uniform float GrnOffset = 0.0f;
-uniform float BluOffset = 0.0f;
-
-uniform float RedScale = 1.0f;
-uniform float GrnScale = 1.0f;
-uniform float BluScale = 1.0f;
-
-uniform float RedFloor = 0.0f;
-uniform float GrnFloor = 0.0f;
-uniform float BluFloor = 0.0f;
-
+uniform float3 RedRatios = float3(1.0f, 0.0f, 0.0f);
+uniform float3 GrnRatios = float3(0.0f, 1.0f, 0.0f);
+uniform float3 BluRatios = float3(0.0f, 0.0f, 1.0f);
+uniform float3 Offset = float3(0.0f, 0.0f, 0.0f);
+uniform float3 Scale = float3(1.0f, 1.0f, 1.0f);
uniform float Saturation = 1.0f;
float4 ps_main(PS_INPUT Input) : COLOR
@@ -107,14 +90,12 @@ float4 ps_main(PS_INPUT Input) : COLOR
float3 OutRGB = BaseTexel.rgb;
// -- RGB Tint & Shift --
- float ShiftedRed = dot(OutRGB, float3(RedFromRed, RedFromGrn, RedFromBlu));
- float ShiftedGrn = dot(OutRGB, float3(GrnFromRed, GrnFromGrn, GrnFromBlu));
- float ShiftedBlu = dot(OutRGB, float3(BluFromRed, BluFromGrn, BluFromBlu));
+ float ShiftedRed = dot(OutRGB, RedRatios);
+ float ShiftedGrn = dot(OutRGB, GrnRatios);
+ float ShiftedBlu = dot(OutRGB, BluRatios);
// -- RGB Offset & Scale --
- float3 RGBScale = float3(RedScale, GrnScale, BluScale);
- float3 RGBShift = float3(RedOffset, GrnOffset, BluOffset);
- float3 OutTexel = float3(ShiftedRed, ShiftedGrn, ShiftedBlu) * RGBScale + RGBShift;
+ float3 OutTexel = float3(ShiftedRed, ShiftedGrn, ShiftedBlu) * Scale + Offset;
// -- Saturation --
float3 Gray = float3(0.3f, 0.59f, 0.11f);
@@ -122,7 +103,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
float3 OutChroma = OutTexel - OutLuma;
float3 Saturated = OutLuma + OutChroma * Saturation;
- return float4(OutRGB, BaseTexel.a);
+ return float4(Saturated, BaseTexel.a);
}
//-----------------------------------------------------------------------------