Divergent/mods/Screen Space Shaders/gamedata/shaders/r3/ssfx_volumetric_combine.ps

45 lines
970 B
PostScript
Raw Normal View History

/**
* @ Version: SCREEN SPACE SHADERS - UPDATE 22
* @ Description: Volumetric Combine Phase
* @ Modified time: 2024-11-25 08:42
* @ Author: https://www.moddb.com/members/ascii1457
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
*/
#include "common.h"
Texture2D vol_point;
#ifndef USE_MSAA
Texture2D vol_buffer;
#else
#ifndef SM_5
Texture2DMS<float4,MSAA_SAMPLES> vol_buffer;
#else
Texture2DMS<float4> vol_buffer;
#endif
#endif
float4 main ( p_screen I ) : SV_Target
{
#ifndef USE_MSAA
float3 vol_a = vol_buffer.SampleLevel(smp_rtlinear, I.tc0, 0).rgb;
#else
float2 tc = I.tc0.xy * screen_res.xy;
float3 vol_a = vol_buffer.Load(int3(tc, 0), 0);
[unroll] for(int iSample = 1; iSample < MSAA_SAMPLES; ++iSample)
{
vol_a += vol_buffer.Load(int3(tc, 0), iSample);
}
vol_a /= MSAA_SAMPLES;
#endif
float3 vol_b = vol_point.SampleLevel(smp_rtlinear, I.tc0, 0).rgb;
return float4(saturate(vol_a + vol_b), 0);
}