From 40174b18402b5635e9975d6e1eb6059d80574ba9 Mon Sep 17 00:00:00 2001 From: SkyLoaderr Date: Wed, 3 Jul 2019 11:30:31 +0300 Subject: [PATCH] xrRenderR1 shaders: fixed fogging wallmarks --- .../shaders/r1/effects_wallmarkblend.s | 10 +++--- res/gamedata/shaders/r1/wmark_blend.vs | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 res/gamedata/shaders/r1/wmark_blend.vs diff --git a/res/gamedata/shaders/r1/effects_wallmarkblend.s b/res/gamedata/shaders/r1/effects_wallmarkblend.s index 6626647..ed11855 100644 --- a/res/gamedata/shaders/r1/effects_wallmarkblend.s +++ b/res/gamedata/shaders/r1/effects_wallmarkblend.s @@ -1,5 +1,5 @@ function normal (shader, t_base, t_second, t_detail) - shader:begin ("wmark", "vert") + shader:begin ("wmark_blend", "vert") : sorting (2, false) : blend (true,blend.srcalpha,blend.invsrcalpha) : aref (true,0) @@ -9,11 +9,11 @@ function normal (shader, t_base, t_second, t_detail) end function l_spot (shader, t_base, t_second, t_detail) - r1_lspot (shader, t_base, "wmark_spot") - shader : sorting (2, false) + r1_lspot (shader, t_base, "wmark_spot") + shader:sorting(2, false) end function l_point (shader, t_base, t_second, t_detail) - r1_lpoint (shader, t_base, "wmark_point") - shader : sorting (2, false) + r1_lpoint (shader, t_base, "wmark_point") + shader:sorting(2, false) end diff --git a/res/gamedata/shaders/r1/wmark_blend.vs b/res/gamedata/shaders/r1/wmark_blend.vs new file mode 100644 index 0000000..a45ccc1 --- /dev/null +++ b/res/gamedata/shaders/r1/wmark_blend.vs @@ -0,0 +1,34 @@ +#include "common.h" +#include "shared\wmark.h" + +// for multiplicative decal + +// For alpha-blend decal +struct vf +{ + float4 hpos : POSITION; + float2 tc0 : TEXCOORD0; + float4 c0 : COLOR0; // c0=all lighting + float fog : FOG; +}; + +vf main (v_vert v) +{ + vf o; + + float3 N = unpack_normal (v.N); + float4 P = wmark_shift (v.P,N); + o.hpos = mul (m_VP, P); // xform, input in world coords + o.tc0 = unpack_tc_base (v.uv0,v.T.w,v.B.w); // copy tc + + float3 L_rgb = v.color.xyz; // precalculated RGB lighting + float3 L_hemi = v_hemi(N)*v.N.w; // hemisphere + float3 L_sun = v_sun(N)*v.color.w; // sun + float3 L_final = L_rgb + L_hemi + L_sun + L_ambient; + + o.c0.rgb = L_final; + o.c0.a = calc_fogging (P); // fog, input in world coords + o.fog = o.c0.a; // fog, input in world coords + + return o; +}