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.

31 lines
643 B

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. sampler g_sBase : register( s0 );
  3. float g_flAlpha : register( c0 );
  4. float g_flDesaturate : register( c1 );
  5. float3 g_vColorFade : register( c2 );
  6. struct PS_INPUT
  7. {
  8. float2 uv : TEXCOORD0;
  9. };
  10. float4 main( PS_INPUT i ) : COLOR0
  11. {
  12. // Fetch blurred texel
  13. float4 o = tex2D( g_sBase, i.uv );
  14. // Desaturate
  15. float3 tmpv = { 0.2125, 0.7154, 0.0721 };
  16. float flLuminance = dot( o.rgb, tmpv.rgb );
  17. o.rgb = lerp( o.rgb, flLuminance, saturate( g_flDesaturate ) );
  18. // Color fade
  19. o.rgb *= g_vColorFade.rgb;
  20. // Set alpha blend value
  21. o.a = g_flAlpha;
  22. return o;
  23. }