diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/stdshaders/haloaddoutline_ps2x.fxc | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'materialsystem/stdshaders/haloaddoutline_ps2x.fxc')
| -rw-r--r-- | materialsystem/stdshaders/haloaddoutline_ps2x.fxc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/materialsystem/stdshaders/haloaddoutline_ps2x.fxc b/materialsystem/stdshaders/haloaddoutline_ps2x.fxc new file mode 100644 index 0000000..8e3127c --- /dev/null +++ b/materialsystem/stdshaders/haloaddoutline_ps2x.fxc @@ -0,0 +1,34 @@ +//======= 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 ); + +float2 g_vPixelSize : register( c4 ); + +struct PS_INPUT +{ + float2 baseTexCoord : TEXCOORD0; // Base texture coordinate +}; + +float4 main( PS_INPUT i ) : COLOR +{ + // Make outline 2 pixels wide $C0_X in a vmt doesn't seem to work in staging so I can't parameterize this right now + float2 vOffset = 2.0f * g_vPixelSize.xy; + + // Take the max of 4 offset texture samples + float4 result; + result.rgba = tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, vOffset.y ) ); + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, -vOffset.y ) ) ); + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, vOffset.y ) ) ); + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, -vOffset.y ) ) ); + + // 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; +} |