Skip to content

Commit 831334a

Browse files
committed
SSS 18.1 -> 21 update existing shaders
1 parent f697fe0 commit 831334a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+333
-313
lines changed

res/gamedata/shaders/r5/accum_base.ps

190 Bytes
Binary file not shown.
303 Bytes
Binary file not shown.
267 Bytes
Binary file not shown.
257 Bytes
Binary file not shown.

res/gamedata/shaders/r5/accum_volumetric.s

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ function normal (shader, t_base, t_second, t_detail)
33
: fog (false)
44
: zb (true,false)
55
: blend (true,blend.one,blend.one)
6-
-- : aref (true,0)
76
: sorting (2, false)
8-
-- TODO: Implement sampler states
9-
-- shader:sampler ("s_lmap") :texture (t_base): clamp()
10-
-- shader:sampler ("s_smap") :texture ("null")
11-
-- shader:sampler ("s_noise") :texture("fx\\fx_noise") : f_linear ()
127

138
shader:dx10texture ("s_lmap", t_base)
149
shader:dx10texture ("s_smap", "null")
15-
shader:dx10texture ("s_noise", "fx\\fx_noise")
10+
shader:dx10texture ("s_position", "$user$position")
1611

1712
shader:dx10sampler ("smp_rtlinear")
18-
shader:dx10sampler ("smp_linear")
19-
-- shader:dx10sampler ("smp_jitter")
2013
shader:dx10sampler ("smp_smap")
14+
shader:dx10sampler ("smp_jitter")
2115
end

res/gamedata/shaders/r5/accum_volumetric.vs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,25 @@ struct v2p
1212
float3 lightToPos : TEXCOORD0; // light center to plane vector
1313
float3 vPos : TEXCOORD1; // position in camera space
1414
float fDensity : TEXCOORD2; // plane density alon Z axis
15-
// float2 tNoise : TEXCOORD3; // projective noise
1615
float3 clip0 : SV_ClipDistance0;
1716
float3 clip1 : SV_ClipDistance1;
1817
float4 hpos : SV_Position;
1918
};
2019

20+
//float4x4 m_texgen;
21+
2122
v2p main ( float3 P : POSITION )
2223
{
2324
v2p o;
2425
float4 vPos;
2526
vPos.xyz = lerp( vMinBounds, vMaxBounds, P); // Position in camera space
26-
vPos.w = 1;
27-
o.hpos = mul (m_P, vPos); // xform, input in camera coordinates
27+
vPos.w = 1.0;
28+
o.hpos = mul(m_P, vPos); // xform, input in camera coordinates
2829

2930
o.lightToPos = vPos.xyz - Ldynamic_pos.xyz;
3031
o.vPos = vPos;
3132

32-
// o.fDensity = (vMaxBounds.z-vMinBounds.z)/2000.0h;
33-
// o.fDensity = (vMaxBounds.z-vMinBounds.z)/2000.0h*2;
34-
o.fDensity = 1.0h/40.0h;
35-
// o.fDensity = 1.0h/20.0h;
33+
o.fDensity = 1.0 / 40.0;
3634

3735
for (int i=0; i<3; ++i)
3836
{

res/gamedata/shaders/r5/accum_volumetric_nomsaa.s

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ function normal (shader, t_base, t_second, t_detail)
33
: fog (false)
44
: zb (true,false)
55
: blend (true,blend.one,blend.one)
6-
-- : aref (true,0)
76
: sorting (2, false)
8-
-- TODO: Implement sampler states
9-
-- shader:sampler ("s_lmap") :texture (t_base): clamp()
10-
-- shader:sampler ("s_smap") :texture ("null")
11-
-- shader:sampler ("s_noise") :texture("fx\\fx_noise") : f_linear ()
127

138
shader:dx10texture ("s_lmap", t_base)
149
shader:dx10texture ("s_smap", "null")
15-
shader:dx10texture ("s_noise", "fx\\fx_noise")
10+
shader:dx10texture ("s_position", "$user$position")
1611

1712
shader:dx10sampler ("smp_rtlinear")
18-
shader:dx10sampler ("smp_linear")
19-
-- shader:dx10sampler ("smp_jitter")
2013
shader:dx10sampler ("smp_smap")
14+
shader:dx10sampler ("smp_jitter")
2115
end
296 Bytes
Binary file not shown.

res/gamedata/shaders/r5/check_screenspace.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
#include "check_screenspace_IL.h"
88
#include "check_screenspace_FLORA.h"
99
#include "check_screenspace_INTER_GRASS.h"
10-
#include "check_screenspace_NEWGLOSS.h"
10+
#include "check_screenspace_NEWGLOSS.h"
11+
#include "check_screenspace_WIND.h"
12+
#include "check_screenspace_SHADOWS.h"
13+
#include "check_screenspace_SSS.h"
14+
#include "check_screenspace_LUT.h"
15+
#include "check_screenspace_PUDDLES.h"

res/gamedata/shaders/r5/combine_1.ps

755 Bytes
Binary file not shown.
913 Bytes
Binary file not shown.
235 Bytes
Binary file not shown.

res/gamedata/shaders/r5/combine_volumetric.s

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ function normal (shader, t_base, t_second, t_detail)
22
shader:begin ("combine_1", "combine_volumetric")
33
: fog (false)
44
: zb (false,false)
5-
: blend (true,blend.invdestcolor,blend.one)
5+
: blend (true,blend.one,blend.one)
66
-- : aref (true,0) -- enable to save bandwith?
77
: sorting (2, false)
88

99
shader:dx10texture ("s_vollight", "$user$generic2")
1010
shader:dx10texture ("s_tonemap", "$user$tonemap")
11+
shader:dx10texture ("noise_tex", "fx\\blue_noise")
1112

13+
shader:dx10texture ("s_position", "$user$position")
14+
15+
shader:dx10sampler ("smp_linear")
1216
shader:dx10sampler ("smp_nofilter")
1317
end
-102 Bytes
Binary file not shown.
-51 Bytes
Binary file not shown.

res/gamedata/shaders/r5/deffer_grass.vs

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define SSFX_WIND_ISGRASS
2+
13
#include "common.h"
24
#include "check_screenspace.h"
35

@@ -9,6 +11,12 @@ float4 wave; // cx,cy,cz,tm
911
float4 dir2D;
1012
float4 array[61*4];
1113

14+
float4 wind;
15+
16+
#ifdef SSFX_WIND
17+
#include "screenspace_wind.h"
18+
#endif
19+
1220
v2p_bumped main (v_detail v)
1321
{
1422
v2p_bumped O;
@@ -20,23 +28,26 @@ v2p_bumped main (v_detail v)
2028
float4 c0 = array[i+3];
2129

2230
// Transform pos to world coords
23-
float4 pos;
24-
pos.x = dot(m0, v.pos);
25-
pos.y = dot(m1, v.pos);
26-
pos.z = dot(m2, v.pos);
27-
pos.w = 1;
28-
29-
//Wave effect
30-
float base = m1.w;
31-
float dp = calc_cyclic(dot(pos, wave));
32-
float H = pos.y - base; // height of vertex (scaled)
31+
float4 P;
32+
P.x = dot(m0, v.pos);
33+
P.y = dot(m1, v.pos);
34+
P.z = dot(m2, v.pos);
35+
P.w = 1;
36+
37+
float H = P.y - m1.w; // height of vertex (scaled)
38+
39+
#ifndef SSFX_WIND
40+
float dp = calc_cyclic(dot(P, wave));
3341
float frac = v.misc.z * consts.x; // fractional
3442
float inten = H * dp;
3543
float2 result = calc_xz_wave(dir2D.xz * inten, frac);
3644

37-
// Add wind
38-
pos = float4(pos.x + result.x, pos.y, pos.z + result.y, 1);
39-
45+
float4 pos = float4(P.x + result.x, P.y, P.z + result.y, 1);
46+
#else
47+
float3 wind_result = ssfx_wind_grass(P.xyz, H, ssfx_wind_setup());
48+
float4 pos = float4(P.xyz + wind_result.xyz, 1);
49+
#endif
50+
4051
// INTERACTIVE GRASS - SSS Update 15.4
4152
// https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders/
4253
#ifdef SSFX_INTER_GRASS
@@ -71,10 +82,9 @@ v2p_bumped main (v_detail v)
7182
#endif
7283

7384
// FLORA FIXES & IMPROVEMENTS - SSS Update 14.6
74-
// https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders/
75-
85+
// https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders/
7686
// Fake Normal, Bi-Normal and Tangent
77-
float3 N = normalize(float3(pos.x - m0.w, pos.y - m1.w + 1.0f, pos.z - m2.w));
87+
float3 N = normalize(float3(P.x - m0.w, P.y - m1.w + 1.0f, P.z - m2.w));
7888

7989
float3x3 xform = mul ((float3x3)m_WV, float3x3(
8090
0,0,N.x,
-48 Bytes
Binary file not shown.

res/gamedata/shaders/r5/deffer_tree_branch_bump-hq.vs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
/**
2+
* @ Version: SCREEN SPACE SHADERS - UPDATE 19
3+
* @ Description: Trees - Branches/Bushes
4+
* @ Modified time: 2023-12-16 13:53
5+
* @ Author: https://www.moddb.com/members/ascii1457
6+
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
7+
*/
8+
19
#include "common.h"
10+
#include "check_screenspace.h"
211

312
float4 benders_pos[32];
413
float4 benders_setup;
@@ -9,27 +18,39 @@ uniform float4 consts; // {1/quant,1/quant,???,???}
918
uniform float4 c_scale,c_bias,wind,wave;
1019
uniform float2 c_sun; // x=*, y=+
1120

21+
#ifdef SSFX_WIND
22+
#include "screenspace_wind.h"
23+
#endif
24+
1225
v2p_bumped main (v_tree I)
1326
{
1427
I.Nh = unpack_D3DCOLOR(I.Nh);
1528
I.T = unpack_D3DCOLOR(I.T);
1629
I.B = unpack_D3DCOLOR(I.B);
1730

1831
// Transform to world coords
19-
float3 pos = mul (m_xform, I.P);
2032

21-
//
33+
float3 pos = mul(m_xform, I.P);
34+
float H = pos.y - m_xform._24; // height of vertex
35+
float2 tc = (I.tc * consts).xy;
36+
37+
#ifndef SSFX_WIND
2238
float base = m_xform._24 ; // take base height from matrix
2339
float dp = calc_cyclic (wave.w+dot(pos,(float3)wave));
24-
float H = pos.y - base ; // height of vertex (scaled, rotated, etc.)
2540
float frac = I.tc.z*consts.x; // fractional (or rigidity)
2641
float inten = H * dp; // intensity
2742
float2 result = calc_xz_wave (wind.xz*inten*2.0f, frac);
43+
44+
float3 wind_result = float3(result.x, 0, result.y);
45+
#else
46+
float3 wind_result = ssfx_wind_tree_branches(pos, H, tc.y, ssfx_wind_setup());
47+
#endif
48+
2849
#ifdef USE_TREEWAVE
29-
result = 0;
50+
wind_result = 0;
3051
#endif
31-
float4 w_pos = float4(pos.x+result.x, pos.y, pos.z+result.y, 1);
32-
float2 tc = (I.tc * consts).xy;
52+
float4 w_pos = float4(pos.xyz + wind_result.xyz, 1);
53+
3354

3455
// INTERACTIVE GRASS ( Bushes ) - SSS Update 15.4
3556
// https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders/

res/gamedata/shaders/r5/deffer_tree_bump-hq.vs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
1+
/**
2+
* @ Version: SCREEN SPACE SHADERS - UPDATE 19
3+
* @ Description: Trees - Trunk
4+
* @ Modified time: 2023-12-16 13:58
5+
* @ Author: https://www.moddb.com/members/ascii1457
6+
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
7+
*/
8+
19
#include "common.h"
10+
#include "check_screenspace.h"
211

312
uniform float3x4 m_xform ;
413
uniform float3x4 m_xform_v ;
514
uniform float4 consts; // {1/quant,1/quant,???,???}
615
uniform float4 c_scale,c_bias,wind,wave;
716
uniform float2 c_sun; // x=*, y=+
817

18+
#ifdef SSFX_WIND
19+
#include "screenspace_wind.h"
20+
#endif
21+
922
v2p_bumped main (v_tree I)
1023
{
1124
I.Nh = unpack_D3DCOLOR(I.Nh);
1225
I.T = unpack_D3DCOLOR(I.T);
1326
I.B = unpack_D3DCOLOR(I.B);
1427

1528
// Transform to world coords
16-
float3 pos = mul (m_xform, I.P);
29+
float3 pos = mul(m_xform, I.P);
30+
float H = pos.y - m_xform._24; // height of vertex
1731

18-
//
19-
float base = m_xform._24 ; // take base height from matrix
32+
#ifndef SSFX_WIND
2033
float dp = calc_cyclic (wave.w+dot(pos,(float3)wave));
21-
float H = pos.y - base ; // height of vertex (scaled, rotated, etc.)
2234
float frac = I.tc.z*consts.x; // fractional (or rigidity)
2335
float inten = H * dp; // intensity
24-
float2 result = calc_xz_wave (wind.xz*inten, frac);
36+
float2 wind_result = calc_xz_wave (wind.xz*inten, frac);
37+
#else
38+
float2 wind_result = ssfx_wind_tree_trunk(pos, H, ssfx_wind_setup()).xy;
39+
#endif
40+
2541
#ifdef USE_TREEWAVE
26-
result = 0;
42+
wind_result = 0;
2743
#endif
28-
float4 w_pos = float4(pos.x+result.x, pos.y, pos.z+result.y, 1);
44+
float4 w_pos = float4(pos.x + wind_result.x, pos.y, pos.z + wind_result.y, 1);
2945
float2 tc = (I.tc * consts).xy;
3046
float hemi = clamp(I.Nh.w * c_scale.w + c_bias.w, 0.3f, 1.0f); // Limit hemi - SSS Update 14.5
3147
// float hemi = I.Nh.w;

res/gamedata/shaders/r5/deffer_tree_bump.vs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
1+
/**
2+
* @ Version: SCREEN SPACE SHADERS - UPDATE 19
3+
* @ Description: Trees - Trunk ( Burn Sections )
4+
* @ Modified time: 2023-12-16 13:42
5+
* @ Author: https://www.moddb.com/members/ascii1457
6+
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
7+
*/
8+
19
#include "common.h"
10+
#include "check_screenspace.h"
211

312
uniform float3x4 m_xform ;
413
uniform float3x4 m_xform_v ;
514
uniform float4 consts; // {1/quant,1/quant,???,???}
615
uniform float4 c_scale,c_bias,wind,wave;
716
uniform float2 c_sun; // x=*, y=+
817

18+
#ifdef SSFX_WIND
19+
#include "screenspace_wind.h"
20+
#endif
21+
922
v2p_bumped main (v_tree I)
1023
{
1124
I.Nh = unpack_D3DCOLOR(I.Nh);
1225
I.T = unpack_D3DCOLOR(I.T);
1326
I.B = unpack_D3DCOLOR(I.B);
1427

1528
// Transform to world coords
16-
float3 pos = mul (m_xform, I.P);
29+
float3 pos = mul(m_xform, I.P);
30+
float H = pos.y - m_xform._24; // height of vertex
1731

18-
//
19-
float base = m_xform._24 ; // take base height from matrix
32+
#ifndef SSFX_WIND
2033
float dp = calc_cyclic (wave.w+dot(pos,(float3)wave));
21-
float H = pos.y - base ; // height of vertex (scaled, rotated, etc.)
2234
float frac = I.tc.z*consts.x; // fractional (or rigidity)
2335
float inten = H * dp; // intensity
24-
float2 result = calc_xz_wave (wind.xz*inten, frac);
36+
float2 wind_result = calc_xz_wave (wind.xz*inten, frac);
37+
#else
38+
float2 wind_result = ssfx_wind_tree_trunk(pos, H, ssfx_wind_setup()).xy;
39+
#endif
40+
2541
#ifdef USE_TREEWAVE
26-
result = 0;
42+
wind_result = 0;
2743
#endif
28-
float4 w_pos = float4(pos.x+result.x, pos.y, pos.z+result.y, 1);
44+
float4 w_pos = float4(pos.x + wind_result.x, pos.y, pos.z + wind_result.y, 1);
2945
float2 tc = (I.tc * consts).xy;
3046
float hemi = I.Nh.w * c_scale.w + c_bias.w;
31-
// float hemi = I.Nh.w;
3247

3348
// Eye-space pos/normal
3449
v2p_bumped O;

res/gamedata/shaders/r5/details_blend.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ function normal (shader, t_base, t_second, t_detail)
1313
shader:dx10texture("s_base", t_base)
1414
shader:dx10texture("s_bump", "levels\\" .. opt:getLevel() .. "\\" .. t_base.."_bump")
1515
shader:dx10texture("s_bumpX", t_base.."_bump#")
16+
17+
shader:dx10texture("s_waves", "fx\\wind_wave")
1618
1719
shader:dx10sampler("smp_base")
20+
shader:dx10sampler("smp_linear")
21+
shader:dx10sampler("smp_linear2")
1822
end
137 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)