34 lines
888 B
PostScript
34 lines
888 B
PostScript
|
/**
|
||
|
* @ Version: SCREEN SPACE SHADERS - UPDATE 22
|
||
|
* @ Description: Bloom - Downsample
|
||
|
* @ Modified time: 2024-10-26 13:00
|
||
|
* @ Author: https://www.moddb.com/members/ascii1457
|
||
|
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
|
||
|
*/
|
||
|
|
||
|
#include "screenspace_common.h"
|
||
|
|
||
|
uniform float4 blur_setup; // Buffer Res [ x:width | y:height | z:scale | w:offset size ]
|
||
|
|
||
|
float4 main ( p_screen I ) : SV_Target
|
||
|
{
|
||
|
float2 HalfPixel = ((1.0f / blur_setup.xy) * 0.5) * blur_setup.w;
|
||
|
|
||
|
const float2 Coords[4] = {
|
||
|
float2( -HalfPixel.x, HalfPixel.y ),
|
||
|
float2( HalfPixel.x, HalfPixel.y ),
|
||
|
float2( HalfPixel.x, -HalfPixel.y ),
|
||
|
float2( -HalfPixel.x, -HalfPixel.y )
|
||
|
};
|
||
|
|
||
|
float4 Color = s_bloom.Sample(smp_rtlinear, I.tc0) * 4.0f;
|
||
|
|
||
|
for( int x = 0; x < 4; x++ )
|
||
|
{
|
||
|
Color += s_bloom.Sample(smp_rtlinear, I.tc0 + Coords[x]);
|
||
|
}
|
||
|
|
||
|
Color = Color / 8.0f;
|
||
|
|
||
|
return Color;
|
||
|
}
|