70 lines
1.7 KiB
PostScript
70 lines
1.7 KiB
PostScript
|
#include "common.h"
|
||
|
#include "sload.h"
|
||
|
#include "screenspace_hud_raindrops.h"
|
||
|
|
||
|
f_deffer main( p_flat I )
|
||
|
{
|
||
|
f_deffer O;
|
||
|
|
||
|
// HUD Rain drops - SSS Update 17
|
||
|
// https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders/
|
||
|
|
||
|
float4 drops = 0; // xy = Normal | z = Overall str | w = reflection str
|
||
|
|
||
|
if (ssfx_hud_drops_1.y > 0)
|
||
|
{
|
||
|
// Calc droplets
|
||
|
drops.xyz = ssfx_hud_raindrops(s_hud_rain, I.RDrops.xyz, 1.0f);
|
||
|
|
||
|
// Only apply to facing up surfaces [ World Y+ ]
|
||
|
drops.xyz *= saturate(I.RDrops.w);
|
||
|
|
||
|
// Intensity from script ( Cover + Rain intensity )
|
||
|
drops.xyz *= ssfx_hud_drops_1.y;
|
||
|
|
||
|
// Refraction
|
||
|
I.tcdh.xy = saturate(I.tcdh.xy + drops.xy * ssfx_hud_drops_1.w * 0.1f);
|
||
|
|
||
|
// Reflection adjustments
|
||
|
drops.w = ssfx_hud_drops_1.z * dot(L_hemi_color, SSFX_HUD_LIGHTVECTOR);
|
||
|
drops.w = max(drops.w * 0.1f, 3.0f);
|
||
|
}
|
||
|
|
||
|
float gloss = drops.z * ssfx_hud_drops_2.w * 0.25f;
|
||
|
|
||
|
// diffuse
|
||
|
float3 D = tbase (I.tcdh); // IN: rgb.a
|
||
|
|
||
|
#ifdef USE_TDETAIL
|
||
|
// D.rgb = 2*D.rgb*tex2D (s_detail, I.tcdbump).rgb;
|
||
|
D.rgb = 2*D.rgb * s_detail.Sample( smp_base, I.tcdbump ).rgb;
|
||
|
#endif
|
||
|
|
||
|
// hemi,sun,material
|
||
|
float ms = xmaterial ;
|
||
|
#ifdef USE_LM_HEMI
|
||
|
// float4 lm = tex2D( s_hemi, I.lmh );
|
||
|
float4 lm = s_hemi.Sample( smp_rtlinear, I.lmh );
|
||
|
// float h = dot( lm.rgb, 1.h/3.h );
|
||
|
float h = get_hemi(lm);
|
||
|
# ifdef USE_R2_STATIC_SUN
|
||
|
// ms = lm.w ;
|
||
|
ms = get_sun(lm);
|
||
|
# endif
|
||
|
#else
|
||
|
float h = I.position.w ;
|
||
|
# ifdef USE_R2_STATIC_SUN
|
||
|
ms = I.tcdh.w ;
|
||
|
# endif
|
||
|
#endif
|
||
|
|
||
|
// 2. Standart output
|
||
|
float4 Ne = float4( normalize((float3)I.N.xyz + float3(drops.xy * drops.w, 0.0f)), h );
|
||
|
O = pack_gbuffer(
|
||
|
Ne,
|
||
|
float4( I.position.xyz + Ne.xyz*def_virtualh/2.h, ms ),
|
||
|
float4( D.rgb, gloss ) ); // OUT: rgb.gloss
|
||
|
|
||
|
return O;
|
||
|
}
|