You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.7 KiB
45 lines
1.7 KiB
//======= Copyright © 1996-2006, Valve Corporation, All rights reserved. ======
|
|
|
|
// STATIC: "CONVERT_TO_SRGB" "0..1" [ps20b][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
|
|
// STATIC: "CONVERT_TO_SRGB" "0..1" [ps30][= g_pHardwareConfig->NeedsShaderSRGBConversion()] [PC]
|
|
// STATIC: "CONVERT_TO_SRGB" "0..0" [= 0] [XBOX]
|
|
|
|
// DYNAMIC: "PIXELFOGTYPE" "0..1"
|
|
|
|
#include "common_ps_fxc.h"
|
|
#include "shader_constant_register_map.h"
|
|
|
|
sampler TexSampler : register( s0 );
|
|
|
|
const float4 g_FogParams : register( PSREG_FOG_PARAMS );
|
|
const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
|
|
|
|
struct PS_INPUT
|
|
{
|
|
HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
|
|
|
|
float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
|
|
float4 fogFactorW : COLOR1;
|
|
|
|
#if defined( _X360 ) //matching pixel shader inputs to vertex shader outputs to avoid shader patches
|
|
HALF2 detailTexCoord : TEXCOORD1;
|
|
float4 color : TEXCOORD2;
|
|
float3 worldVertToEyeVector : TEXCOORD3;
|
|
float3 worldSpaceNormal : TEXCOORD4;
|
|
float4 vProjPos : TEXCOORD6;
|
|
#endif
|
|
};
|
|
|
|
float4 main( PS_INPUT i ) : COLOR
|
|
{
|
|
float4 result = tex2D( TexSampler, i.baseTexCoord );
|
|
|
|
float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.z, i.worldPos_projPosZ.z, i.worldPos_projPosZ.w );
|
|
|
|
// Since we're blending with a mod2x, we need to compensate with this hack
|
|
// NOTE: If the fog color (not fog density) is extremely dark, this can makes some decals seem
|
|
// a little transparent, but it's better than not doing this
|
|
fogFactor = pow( saturate( fogFactor ), 0.4f );
|
|
|
|
return FinalOutput( result, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_NONE );
|
|
}
|