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.

26 lines
662 B

  1. //========== Copyright (c) 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. float2 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. }