41 lines
1.1 KiB
PostScript
41 lines
1.1 KiB
PostScript
|
/**
|
||
|
* @ Version: SCREEN SPACE SHADERS - UPDATE 22
|
||
|
* @ Description: Rain - Create refraction buffer without rain ( Buffer at 1/8 res )
|
||
|
* @ Modified time: 2024-11-19 22:16
|
||
|
* @ Author: https://www.moddb.com/members/ascii1457
|
||
|
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
|
||
|
*/
|
||
|
|
||
|
#include "screenspace_common.h"
|
||
|
|
||
|
Texture2D ssfx_color_buffer;
|
||
|
Texture2D volumetric_buffer;
|
||
|
|
||
|
float4 main(p_screen I) : SV_Target
|
||
|
{
|
||
|
|
||
|
float2 HalfPixel = (1.0f / (screen_res.xy / 8.0f)) * 2.0;
|
||
|
|
||
|
const float2 Coords[4] = {
|
||
|
float2( -HalfPixel.x, HalfPixel.y ),
|
||
|
float2( HalfPixel.x, HalfPixel.y ),
|
||
|
float2( HalfPixel.x, -HalfPixel.y ),
|
||
|
float2( -HalfPixel.x, -HalfPixel.y )
|
||
|
};
|
||
|
|
||
|
float3 Color = ssfx_color_buffer.Sample( smp_rtlinear, I.tc0 ).rgb * 4.0f;
|
||
|
|
||
|
for( int x = 0; x < 4; x++ )
|
||
|
{
|
||
|
Color += ssfx_color_buffer.Sample( smp_rtlinear, I.tc0 + Coords[x] ).rgb;
|
||
|
}
|
||
|
|
||
|
Color = Color / 8.0f;
|
||
|
|
||
|
// Apply volumetric
|
||
|
float3 Vol = volumetric_buffer.Sample( smp_rtlinear, I.tc0 ).rgb * 5.0f;
|
||
|
Vol *= 1.0f / (2.0f + Vol);
|
||
|
Vol *= 1.0f - saturate(dot(Vol, 1));
|
||
|
|
||
|
return float4(Color + Vol, 1.0f);
|
||
|
}
|