/** * @ Version: SCREEN SPACE SHADERS - UPDATE 21 * @ Description: IL - Blur Phase * @ Modified time: 2024-08-18 08:11 * @ Author: https://www.moddb.com/members/ascii1457 * @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders */ #include "screenspace_common.h" #include "settings_screenspace_IL.h" uniform float4 blur_setup; // x: | y: | z: Buffer width | w: Buffer Height uniform float4 ao_setup; Texture2D ao_image; Texture2D s_hud_mask; float4 main(p_screen I) : SV_Target { float2 tc = I.tc0 * blur_setup.x; float4 base_image = ao_image.SampleLevel(smp_linear, tc, 0); float4 blur = 0; float2 buffer_pixel_size = 1.0 / blur_setup.zw; float radius = 1.0 / ao_setup.x; float2 offset = float2(radius, radius) * ao_setup.w * blur_setup.y; // 0.25 ~ 0.5 ~ 0.75f ~ 1.0f float2 blur_tc = 0; float r = 2.0f; [unroll (G_IL_BLUR_SAMPLES)] for (int i = 0; i < G_IL_BLUR_SAMPLES; i++) { r += 1.0f / r; offset = mul(offset, pp_rotation_matrix); blur_tc = tc + (offset * (r - 1.0f) * buffer_pixel_size); float3 BlurSample = ao_image.SampleLevel(smp_linear, blur_tc, 0).rgb; if (any(blur_tc < 0) || any(blur_tc > radius)) blur += base_image; else blur.rgb += BlurSample.rgb; } blur /= G_IL_BLUR_SAMPLES; return blur.rgba; }