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.
26 lines
662 B
26 lines
662 B
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
|
|
|
|
#include "common_ps_fxc.h"
|
|
|
|
sampler TexSampler : register( s0 );
|
|
|
|
float g_flDimValue : register( c0 );
|
|
|
|
struct PS_INPUT
|
|
{
|
|
float2 baseTexCoord : TEXCOORD0; // Base texture coordinate
|
|
};
|
|
|
|
float4 main( PS_INPUT i ) : COLOR
|
|
{
|
|
float4 result = tex2D( TexSampler, i.baseTexCoord );
|
|
|
|
// Scale by dim value before computing luminance below
|
|
result.rgb *= saturate( g_flDimValue );
|
|
|
|
// Store max color component in alpha for alpha blend of one/invSrcAlpha
|
|
float flLuminance = max( result.r, max( result.g, result.b ) );
|
|
result.a = pow( flLuminance, 0.8f );
|
|
|
|
return result.rgba;
|
|
}
|