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.

34 lines
1.4 KiB

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. // blurs colors by averages
  3. // bleeds alpha by max of current vs averages
  4. sampler g_texSampler : register( s0 );
  5. struct PS_INPUT
  6. {
  7. float2 uv : TEXCOORD0;
  8. };
  9. float2 g_vPsTapOffsets[2] : register( c0 );
  10. float4 main( PS_INPUT i ) : COLOR
  11. {
  12. float4 cOut;
  13. cOut = tex2D( g_texSampler, float2( i.uv.x + g_vPsTapOffsets[0].x, i.uv.y + g_vPsTapOffsets[0].y ) );
  14. cOut += tex2D( g_texSampler, float2( i.uv.x , i.uv.y + g_vPsTapOffsets[0].y ) );
  15. cOut += tex2D( g_texSampler, float2( i.uv.x - g_vPsTapOffsets[0].x, i.uv.y + g_vPsTapOffsets[0].y ) );
  16. cOut += tex2D( g_texSampler, float2( i.uv.x + g_vPsTapOffsets[0].x, i.uv.y ) );
  17. cOut += tex2D( g_texSampler, float2( i.uv.x , i.uv.y ) );
  18. cOut += tex2D( g_texSampler, float2( i.uv.x - g_vPsTapOffsets[0].x, i.uv.y ) );
  19. cOut += tex2D( g_texSampler, float2( i.uv.x + g_vPsTapOffsets[0].x, i.uv.y - g_vPsTapOffsets[0].y ) );
  20. cOut += tex2D( g_texSampler, float2( i.uv.x , i.uv.y - g_vPsTapOffsets[0].y ) );
  21. cOut += tex2D( g_texSampler, float2( i.uv.x - g_vPsTapOffsets[0].x, i.uv.y - g_vPsTapOffsets[0].y ) );
  22. cOut *= (1.0f/9.0f);
  23. cOut.a = max( cOut.a * 1.0f, tex2D( g_texSampler, i.uv ).a ); //never reduce alpha, only increase it
  24. return saturate( cOut );
  25. }