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

40 lines
1.0 KiB
PostScript

/**
* @ Version: SCREEN SPACE SHADERS - UPDATE 22
* @ Description: Bloom - Build
* @ Modified time: 2024-10-28 13:40
* @ 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 ssfx_bloom_1; // Threshold, Exposure, Emmisive, Sky
Texture2D s_scene;
Texture2D s_emissive;
float4 main ( p_screen I ) : SV_Target
{
#ifndef USE_MSAA
float3 P = s_position.Sample( smp_nofilter, I.tc0.xy ).xyz;
#else
float3 P = s_position.Load( int3( I.hpos.xy * 2.0f, 0 ), 0 ).xyz;
#endif
float3 Result = s_scene.SampleLevel(smp_linear, I.tc0.xy, 0).rgb;
// Sky Intensity
Result *= P.z <= SKY_EPS ? ssfx_bloom_1.w : 1.0f;
// Threshold
Result = pow(abs(Result), ssfx_bloom_1.x);
float3 Emissive = s_emissive.SampleLevel(smp_linear, I.tc0.xy, 0).rgb;
// Emissive doesn't use threshold
Result = saturate(Result + Emissive);
return float4(saturate(Result), dot(Emissive, 1));
//return float4(saturate(Result), 1);
}