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.
32 lines
881 B
32 lines
881 B
//========== Copyright (c) Valve Corporation, All rights reserved. ==========//
|
|
|
|
#include "common_ps_fxc.h"
|
|
|
|
|
|
struct PS_INPUT
|
|
{
|
|
float2 vPos : VPOS; // Normalized Screenpos, call ComputeScreenPos() to get useful 2D coordinates
|
|
};
|
|
|
|
sampler TexSampler : register( s0 );
|
|
|
|
float3 Shape( float3 cColor )
|
|
{
|
|
float flLum = saturate(dot( cColor.xyz, float3( 0.3f, 0.59f, 0.11f) ));
|
|
cColor.xyz *= flLum * flLum * flLum * flLum; // TODO: parametrize this
|
|
return cColor;
|
|
}
|
|
|
|
float4 main( PS_INPUT i ) : COLOR
|
|
{
|
|
// NOTE: Shape simulates what downsample_nohdr does to the pixel color
|
|
float4 result = tex2D( TexSampler, saturate( ComputeScreenPos( i.vPos ) ) );
|
|
|
|
// Local contrast needs gamma luminance in alpha
|
|
float3 vGamma = SrgbLinearToGamma( result.rgb );
|
|
result.a = dot( vGamma, float3( 0.299, 0.587, 0.114 ) );
|
|
|
|
result.rgb = Shape( result.rgb );
|
|
|
|
return max( 0, result );
|
|
}
|