Counter Strike : Global Offensive Source Code
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.
|
|
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
// STATIC: "DEPTHBLEND" "0..1" [ps20b] #include "common_fog_ps_fxc.h"
#include "shader_constant_register_map.h"
const float4 g_FogParams : register( PSREG_FOG_PARAMS ); const float4 g_EyePos_SpecExponent : register( PSREG_EYEPOS_SPEC_EXPONENT );
const float4 g_DepthFeatheringConstants : register( c0 );
sampler BumpmapSampler : register( s0 ); sampler DepthSampler : register( s1 );
struct PS_INPUT { float2 vBumpTexCoord : TEXCOORD0; float3 vTangentSpaceLightDir : TEXCOORD1; float3 vAmbientColor : TEXCOORD2; float4 vIteratedProjPos : TEXCOORD3; float4 vDirLightScale : COLOR0; float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog };
float4_color_return_type main( PS_INPUT i ) : COLOR { float4 baseColor = tex2D( BumpmapSampler, i.vBumpTexCoord ); // Dot the bump normal and the light vector. float4 vBumpMapNormal = (baseColor - 0.5); // The format of the sphere map is 0 to 1, // so this is now -0.5 to 0.5.
float3 vTangentSpaceLightDir = (i.vTangentSpaceLightDir - 0.5) * 2; // This is -1 to 1 float4 vOutput = dot( vBumpMapNormal.xyz, vTangentSpaceLightDir.xyz ) + 0.5; // Scale by the light color outputted by the vertex shader (ie: based on distance). vOutput *= i.vDirLightScale;
// Add ambient. vOutput += float4( i.vAmbientColor.x, i.vAmbientColor.y, i.vAmbientColor.z, 0 );
// Alpha = normal map alpha * vertex alpha vOutput.a = baseColor.a * i.vDirLightScale.a; //Soft Particles FTW # if (DEPTHBLEND == 1) vOutput.a *= DepthFeathering( DepthSampler, i.vIteratedProjPos, g_DepthFeatheringConstants ); # endif float fogFactor = CalcPixelFogFactor( PIXELFOGTYPE, g_FogParams, g_EyePos_SpecExponent.xyz, i.worldPos_projPosZ.xyz, i.worldPos_projPosZ.w ); return FinalOutput( vOutput, fogFactor, PIXELFOGTYPE, TONEMAP_SCALE_LINEAR ); }
|