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.

37 lines
985 B

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. //
  3. // Purpose: This is where all common code for vertex shaders go.
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef _FOW_PS_FXC_H
  9. #define _FOW_PS_FXC_H
  10. #if ( FOW == 1 )
  11. static const float3 g_FoWToGray = float3( 0.3, 0.59, 0.11 );
  12. #define FOW_DARKNESS_VALUE 0.5
  13. #define FOW_GRAY_FACTOR 0.75
  14. #define FOW_COLOR_FACTOR 0.25
  15. #define FOW_GRAY_HILIGHTS 2.0
  16. float3 CalcFoW( const sampler FoWSampler, const float2 vFoWCoords, const float3 CurrentColor )
  17. {
  18. float vFoWResult = tex2D( FoWSampler, vFoWCoords.xy ).r;
  19. float3 vGray = pow( dot( CurrentColor, g_FoWToGray ), FOW_GRAY_HILIGHTS );
  20. float3 vFinalColor = ( vGray * FOW_GRAY_FACTOR * FOW_DARKNESS_VALUE ) + ( CurrentColor * FOW_COLOR_FACTOR * FOW_DARKNESS_VALUE );
  21. return ( vFinalColor * ( 1.0 - vFoWResult ) ) + ( CurrentColor * vFoWResult );
  22. }
  23. #endif
  24. #endif // _FOW_PS_FXC_H