Divergent/mods/Enhanced Shaders Color Grading/gamedata/shaders/r3/bloom_build.ps

43 lines
1.0 KiB
PostScript

#include "common.h"
float4 b_params;
//////////////////////////////////////////////////////////////////////////////////////////
// Pixel
float4 main ( p_build I ) : SV_Target
{
float2 ratio = float2( 1/screen_res.x,1/screen_res.y).xy;
ratio.x = 1;
//ratio.y = 1.77;
//ratio.y = 0.5625;
ratio.y = screen_res.x/screen_res.y;
float2 UVavg = I.Tex0.xy;
//adjust for aspect ratio
I.Tex0 = UVavg + ((I.Tex0 - UVavg) * ratio);
I.Tex1 = UVavg + ((I.Tex1 - UVavg) * ratio);
I.Tex2 = UVavg + ((I.Tex2 - UVavg) * ratio);
I.Tex3 = UVavg + ((I.Tex3 - UVavg) * ratio);
// hi-rgb.base-lum
float3 s0 = s_image.Sample( smp_rtlinear, I.Tex0);
float3 s1 = s_image.Sample( smp_rtlinear, I.Tex1);
float3 s2 = s_image.Sample( smp_rtlinear, I.Tex2);
float3 s3 = s_image.Sample( smp_rtlinear, I.Tex3);
float3 avg = ( (s0+s1) + (s2+s3) )/4;
/*
float sum = saturate(dot( avg, 1.h ));
avg /= sum;
float hi = sum-b_params.x ; // assume def_hdr equal to 3.0
*/
float hi = 1-b_params.x;
//float hi = 1;
return float4( avg, hi );
}