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.

24 lines
764 B

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. #include "common_ps_fxc.h"
  3. sampler InputSampler : register( s0 );
  4. sampler FilmGrain : register( s1 );
  5. const float4 vNoiseScale : register( c0 );
  6. struct PS_INPUT
  7. {
  8. float2 inputImageCoords : TEXCOORD0; // Input image having grain added
  9. float2 filmGrainCoords : TEXCOORD1; // Tiling film grain texture
  10. };
  11. float4_color_return_type main( PS_INPUT i ) : COLOR
  12. {
  13. float3 hsl = RGBtoHSL( tex2D( InputSampler, i.inputImageCoords ) ).rgb;
  14. float3 hslNoise = tex2D( FilmGrain, i.filmGrainCoords ).rgb * 2.0f - 1.0f;
  15. hsl.rgb += hslNoise.rgb * vNoiseScale.rgb * float3( 0.5f, 1.0f, 1.0f );
  16. return FinalOutput( float4 ( hsl.rgb, 1.0f ), 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_NONE );
  17. }