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.

60 lines
1.7 KiB

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. #include "common_ps_fxc.h"
  3. sampler FBSampler : register( s0 );
  4. sampler BloomSampler : register( s1 );
  5. const float4 settings : register( c0 );
  6. // x=sharpness,y=woodcut,z=bloom_amt,w=alpha sharpen factor
  7. const float4 settings2 : register( c1 ); // x=bloom exp,y=vignette min scale z=vignette_power
  8. struct PS_INPUT
  9. {
  10. float2 texCoord : TEXCOORD0;
  11. //float2 bloomTexCoord : TEXCOORD2;
  12. };
  13. float4 main( PS_INPUT i ) : COLOR
  14. {
  15. float4 fbSample = tex2D( FBSampler, i.texCoord );
  16. return fbSample; // Temporary hack to work around color tint problem in float HDR mode. This disables bloom in this mode.
  17. /*
  18. float4 bloom=tex2D(BloomSampler,i.bloomTexCoord);
  19. float2 xofs=2*(i.texCoord-float2(0.5,0.5));
  20. float dist=(1.0/2.0)*(xofs.x*xofs.x+xofs.y*xofs.y);
  21. float vig=pow(1-dist,settings2.z);
  22. fbSample=lerp(fbSample,bloom,(1-vig)*settings2.w);
  23. fbSample=lerp(bloom,fbSample,settings.x+settings.w*fbSample.a*settings2.w);
  24. float3 woodcut;
  25. if (bloom.x<fbSample.x)
  26. woodcut.x=1.0;
  27. else
  28. woodcut.x=0.0;
  29. if (bloom.y<fbSample.y)
  30. woodcut.y=1.0;
  31. else
  32. woodcut.y=0.0;
  33. if (bloom.z<fbSample.z)
  34. woodcut.z=1.0;
  35. else
  36. woodcut.z=0.0;
  37. fbSample.xyz=lerp(fbSample.xyz,woodcut.xyz,settings.y);
  38. bloom.xyz*=sqrt(LINEAR_LIGHT_SCALE);
  39. bloom.xyz=min(bloom.xyz,1.0);
  40. float lum=.3*bloom.x+.59*bloom.y+.11*bloom.z;
  41. lum=min(1.0,lum);
  42. float4 c_out=float4(cLightScale.xyz, 1) * fbSample + settings.z * pow(lum, settings2.x) * bloom;
  43. // calculate vignette (lens brightness falloff near edges)
  44. c_out.xyz*=max(settings2.y,vig);
  45. return FinalOutput( c_out, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
  46. */
  47. }