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.
48 lines
1.9 KiB
48 lines
1.9 KiB
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
|
|
|
|
// Includes =======================================================================================
|
|
#include "common_vertexlitgeneric_dx9.h"
|
|
|
|
// Texture Samplers ===============================================================================
|
|
sampler g_tBaseSampler : register( s0 );
|
|
sampler g_tFlowSampler : register( s1 );
|
|
sampler g_tSelfIllumSampler : register( s2 );
|
|
|
|
// Shaders Constants and Globals ==================================================================
|
|
const float4 g_vPackedConst0 : register( c0 );
|
|
#define g_flBlendStrength g_vPackedConst0.x
|
|
#define g_flTime g_vPackedConst0.y
|
|
|
|
const float2 g_vEmissiveScrollVector : register( c1 );
|
|
const float3 g_cSelfIllumTint : register( c2 );
|
|
|
|
// Interpolated values ============================================================================
|
|
struct PS_INPUT
|
|
{
|
|
float2 vTexCoord0 : TEXCOORD0;
|
|
};
|
|
|
|
// Main ===========================================================================================
|
|
//float4 main( PS_INPUT i ) : COLOR // Non-HDR for debugging
|
|
float4_color_return_type main( PS_INPUT i ) : COLOR
|
|
{
|
|
// Color texture
|
|
float4 cBaseColor = tex2D( g_tBaseSampler, i.vTexCoord0.xy );
|
|
|
|
// Fetch from dudv map and then fetch from emissive texture with new uv's & scroll
|
|
float4 vFlowValue = tex2D( g_tFlowSampler, i.vTexCoord0.xy );
|
|
float2 vEmissiveTexCoord = vFlowValue.xy + ( g_vEmissiveScrollVector.xy * g_flTime );
|
|
float4 cEmissiveColor = tex2D( g_tSelfIllumSampler, vEmissiveTexCoord.xy );
|
|
|
|
//===============//
|
|
// Combine terms //
|
|
//===============//
|
|
float4 result;
|
|
result.rgb = cBaseColor.rgb * cEmissiveColor.rgb * g_cSelfIllumTint.rgb;
|
|
result.rgb *= g_flBlendStrength;
|
|
|
|
// Set alpha to 0.0f so it doesn't change dest alpha (I should probably disable dest alpha writes)
|
|
result.a = 0.0f;
|
|
|
|
return FinalOutput( result, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_LINEAR );
|
|
}
|