mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-06-09 04:12:14 +03:00
This should include the latest version of every shader that was in the 2007 SDK. It also includes a smattering of debug shaders, both VR distortion shaders, and other assorted shaders that will hopefully be useful. None of these new files are included in the game shader DLL project. If you need to modify one of these shaders for use in your mod you will need to rename it so that you don't collide with the version of that shader that lives in stdshader_dx9.dll.
50 lines
1.1 KiB
Plaintext
50 lines
1.1 KiB
Plaintext
// DYNAMIC: "CMBO_USERENDERTARGET" "0..1"
|
|
|
|
#include "shader_constant_register_map.h"
|
|
#include "common_ps_fxc.h"
|
|
|
|
sampler BaseTextureSampler : register( s0 );
|
|
sampler DistortMapTextureSampler : register( s1 );
|
|
|
|
|
|
struct PS_INPUT
|
|
{
|
|
float2 vBaseTexCoord : TEXCOORD0;
|
|
};
|
|
|
|
|
|
float4 main( PS_INPUT i ) : COLOR
|
|
{
|
|
float2 vOriginal = i.vBaseTexCoord.xy;
|
|
|
|
float4 vRead = tex2D( DistortMapTextureSampler, vOriginal );
|
|
|
|
float2 vGreen;
|
|
vGreen.r = ( vRead.x + vRead.z ) / 2.0;
|
|
vGreen.g = ( vRead.y + vRead.w ) / 2.0;
|
|
|
|
float4 vFinal;
|
|
vFinal.r = tex2D( BaseTextureSampler, vRead.xy ).r;
|
|
vFinal.ga = tex2D( BaseTextureSampler, vGreen ).ga;
|
|
vFinal.b = tex2D( BaseTextureSampler, vRead.zw ).b;
|
|
|
|
float fBoundsCheck;
|
|
#if ( CMBO_USERENDERTARGET )
|
|
{
|
|
fBoundsCheck = saturate( dot( (vGreen.xy < float2(0.01,0.01)), float2(1,1)) + dot( (vGreen.xy > float2(0.99,0.99)), float2(1,1)) );
|
|
}
|
|
#else
|
|
{
|
|
fBoundsCheck = saturate( dot( (vGreen.xy < float2(0.005,0.005)), float2(1,1)) + dot( (vGreen.xy > float2(0.995,0.995)), float2(1,1))
|
|
+ (vGreen.x > 0.495 && vGreen.x < 0.505 ) );
|
|
}
|
|
#endif
|
|
|
|
vFinal.xyz = lerp( vFinal.xyz, float3(0,0,0), fBoundsCheck );
|
|
|
|
return vFinal;
|
|
}
|
|
|
|
|
|
|