summaryrefslogtreecommitdiff
path: root/materialsystem/stdshaders/haloadd1d_ps2x.fxc
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/stdshaders/haloadd1d_ps2x.fxc
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'materialsystem/stdshaders/haloadd1d_ps2x.fxc')
-rw-r--r--materialsystem/stdshaders/haloadd1d_ps2x.fxc35
1 files changed, 35 insertions, 0 deletions
diff --git a/materialsystem/stdshaders/haloadd1d_ps2x.fxc b/materialsystem/stdshaders/haloadd1d_ps2x.fxc
new file mode 100644
index 0000000..a392de2
--- /dev/null
+++ b/materialsystem/stdshaders/haloadd1d_ps2x.fxc
@@ -0,0 +1,35 @@
+//======= Copyright � 1996-2006, Valve Corporation, All rights reserved. ======
+
+#include "common_ps_fxc.h"
+
+sampler TexSampler : register( s0 );
+sampler TexRed : register( s1 );
+sampler TexGreen : register( s2 );
+sampler TexBlue : register( s3 );
+
+float g_flDimValue : register( c0 );
+
+struct PS_INPUT
+{
+ HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
+};
+
+float4 main( PS_INPUT i ) : COLOR
+{
+ float4 result = tex2D( TexSampler, i.baseTexCoord );
+
+ // Scale by dim value before computing luminance below
+ result.rgb *= saturate( g_flDimValue );
+
+ // Fetch into 1D textures based on the intensity of each color channel and sum
+ float4 vRed = tex2D( TexRed, pow( result.r, 0.45 ) );
+ float4 vGreen = tex2D( TexGreen, pow( result.g, 0.45 ) );
+ float4 vBlue = tex2D( TexBlue, pow( result.b, 0.45 ) );
+ result.rgb = vRed.rgb + vGreen.rgb + vBlue.rgb;
+
+ // Store max color component in alpha for alpha blend of one/invSrcAlpha
+ float flLuminance = max( result.r, max( result.g, result.b ) );
+ result.a = flLuminance;
+
+ return result.rgba;
+}