sourcearena/sp/src/materialsystem/stdshaders/WorldVertexAlpha_ps2x.fxc
Joe Ludwig 7309a5f13f Added many shader source files
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.
2013-12-23 15:00:03 -08:00

44 lines
1.3 KiB
Plaintext

// STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
// STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
// STATIC: "PASS" "0..1"
#define HDRTYPE HDR_TYPE_NONE
#include "common_ps_fxc.h"
// CENTROID: TEXCOORD1
sampler BaseSampler : register( s0 );
sampler LightmapSampler: register( s1 );
sampler LightmapAlphaSampler: register( s2 );
struct PS_INPUT
{
float2 baseCoord : TEXCOORD0;
float2 lightmapCoord : TEXCOORD1;
};
float4 main( PS_INPUT i ) : COLOR
{
bool bAlphaPass = PASS ? true : false;
float4 base = tex2D( BaseSampler, i.baseCoord );
float4 lightmap = tex2D( LightmapSampler, i.lightmapCoord );
float4 alpha = tex2D( LightmapAlphaSampler, i.lightmapCoord );
float4 color;
base.a = dot( base, HALF3( HALF_CONSTANT(0.33333f), HALF_CONSTANT(0.33333f), HALF_CONSTANT(0.33333f) ) );
color = 2.0f * base * lightmap; // The 2x is for an assumed overbright 2 (it's always 2 on dx9)
if( bAlphaPass )
{
// Don't care about color, just return pre-multiplied alpha
return FinalOutput( float4( 0.0f, 0.0f, 1.0f, (1.0f - alpha.a) * color.a ), 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
}
else
{
return FinalOutput( float4( color.rgb, (1.0f - alpha.a) ), 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
}
}