Divergent/mods/Shaders Look Better/gamedata/shaders/r3/rain_layer.ps

30 lines
588 B
PostScript

#include "common.h"
#include "lmodel.h"
#include "shadow.h"
Texture2D s_water;
float4 main ( float2 tc : TEXCOORD0, float2 tcJ : TEXCOORD1, float4 pos2d : SV_Position ) : SV_Target
{
gbuffer_data gbd = gbuffer_load_data( tc, pos2d );
float4 _P = float4( gbd.P, 1.0 );
float4 PS = mul( m_shadow, _P );
float s = shadow(PS, pos2d.xy);
float2 tc1 = mul( m_sunmask, _P ); //
tc1 /= 2;
tc1 = frac(tc1);
float4 water = s_water.SampleLevel( smp_linear, tc1, 0 );
water.xyz = (water.xzy-0.5)*2;
water.xyz = mul( m_V, water.xyz );
water *= s;
return float4(water.xyz,s);
}