Team Fortress 2 Source Code as on 22/4/2020
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
661 B

  1. //======= Copyright � 1996-2006, Valve Corporation, All rights reserved. ======
  2. #include "common_ps_fxc.h"
  3. sampler TexSampler : register( s0 );
  4. float g_flDimValue : register( c0 );
  5. struct PS_INPUT
  6. {
  7. HALF2 baseTexCoord : TEXCOORD0; // Base texture coordinate
  8. };
  9. float4 main( PS_INPUT i ) : COLOR
  10. {
  11. float4 result = tex2D( TexSampler, i.baseTexCoord );
  12. // Scale by dim value before computing luminance below
  13. result.rgb *= saturate( g_flDimValue );
  14. // Store max color component in alpha for alpha blend of one/invSrcAlpha
  15. float flLuminance = max( result.r, max( result.g, result.b ) );
  16. result.a = pow( flLuminance, 0.8f );
  17. return result.rgba;
  18. }