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.

42 lines
976 B

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. #include "common_ps_fxc.h"
  3. sampler LowSampler : register( s0 );
  4. sampler HiSampler : register( s1 );
  5. struct PS_INPUT
  6. {
  7. float2 texCoord : TEXCOORD0;
  8. };
  9. struct MYHDR_PS_OUTPUT
  10. {
  11. float4 color[2] : COLOR0;
  12. };
  13. MYHDR_PS_OUTPUT main( PS_INPUT i ) : COLOR
  14. {
  15. float3 lowColor = GammaToLinear( tex2D( LowSampler, i.texCoord ) );
  16. float3 hiColor = GammaToLinear( tex2D( HiSampler, i.texCoord ) );
  17. float4 lowOut;
  18. lowOut.a = 1.0f;
  19. float4 hiOut;
  20. hiOut.a = 1.0f;
  21. float3 hdrColor = max( lowColor, hiColor * MAX_HDR_OVERBRIGHT );
  22. float fMax = max( hdrColor.b, max( hdrColor.r, hdrColor.g ) );
  23. float blendFactor = saturate( ( fMax - 0.9f ) * 10.0f );
  24. blendFactor = 1.0f;
  25. lowOut.rgb = LinearToGamma( lowColor * ( 1.0f - blendFactor ) );
  26. hiOut.rgb = LinearToGamma( hiColor * ( blendFactor ) );
  27. MYHDR_PS_OUTPUT output;
  28. output.color[0] = lowOut;
  29. output.color[1] = hiOut;
  30. return output;
  31. }