Skip to content

Commit f697fe0

Browse files
committed
SSS 18.1 -> 21 add new shaders
1 parent bc0e9e4 commit f697fe0

Some content is hidden

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

44 files changed

+965
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define SSFX_LUT_INUSE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define SSFX_PUDDLES
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define SSFX_SHADOWS
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define SSFX_SSS
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define SSFX_WIND
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#define USE_TDETAIL
2+
3+
#include "common.h"
4+
5+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
6+
#define v_in v_static_color
7+
#else
8+
#define v_in v_static
9+
#endif
10+
11+
12+
v2p_bumped main( v_in I )
13+
{
14+
float4 w_pos = I.P ;
15+
float2 tc = unpack_tc_base (I.tc,I.T.w,I.B.w); // copy tc
16+
float hemi = I.Nh.w ;
17+
18+
// Eye-space pos/normal
19+
v2p_bumped O;
20+
float3 Pe = mul (m_WV, w_pos );
21+
O.hpos = mul (m_WVP, w_pos );
22+
O.tcdh = float4 (tc.xyyy );
23+
O.position = float4 (Pe, hemi );
24+
25+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
26+
O.tcdh.w = I.color.w; // (r,g,b,dir-occlusion)
27+
#endif
28+
29+
// Calculate the 3x3 transform from tangent space to eye-space
30+
// TangentToEyeSpace = object2eye * tangent2object
31+
// = object2eye * transpose(object2tangent) (since the inverse of a rotation is its transpose)
32+
I.Nh = unpack_D3DCOLOR(I.Nh);
33+
I.T = unpack_D3DCOLOR(I.T);
34+
I.B = unpack_D3DCOLOR(I.B);
35+
float3 N = unpack_bx4(I.Nh); // just scale (assume normal in the -.5f, .5f)
36+
float3 T = unpack_bx4(I.T); //
37+
float3 B = unpack_bx4(I.B); //
38+
float3x3 xform = mul ((float3x3)m_WV, float3x3(
39+
T.x,B.x,N.x,
40+
T.y,B.y,N.y,
41+
T.z,B.z,N.z
42+
));
43+
// The pixel shader operates on the bump-map in [0..1] range
44+
// Remap this range in the matrix, anyway we are pixel-shader limited :)
45+
// ...... [ 2 0 0 0]
46+
// ...... [ 0 2 0 0]
47+
// ...... [ 0 0 2 0]
48+
// ...... [-1 -1 -1 1]
49+
// issue: strange, but it's slower :(
50+
// issue: interpolators? dp4? VS limited? black magic?
51+
52+
// Feed this transform to pixel shader
53+
O.M1 = xform[0];
54+
O.M2 = xform[1];
55+
O.M3 = xform[2];
56+
57+
#ifdef USE_TDETAIL
58+
O.tcdbump = O.tcdh * dt_params; // dt tc
59+
#endif
60+
61+
#ifdef USE_LM_HEMI
62+
O.lmh = unpack_tc_lmap (I.lmh);
63+
#endif
64+
return O;
65+
}
66+
67+
FXVS;
Binary file not shown.
660 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* @ Version: SCREEN SPACE SHADERS - UPDATE 20
3+
* @ Description: LUT shader
4+
* @ Modified time: 2024-01-22 04:12
5+
* @ Author: https://www.moddb.com/members/ascii1457
6+
* @ Mod: https://www.moddb.com/mods/stalker-anomaly/addons/screen-space-shaders
7+
*/
8+
9+
// Settings
10+
#include "settings_screenspace_LUT.h"
11+
12+
// Internal --
13+
#define LUT_GROUPS max(1, G_CELLS_GROUPS)
14+
#define TEXEL_SIZE float2(1.0f / G_LUT_SIZE_W, 1.0f / (G_CELLS_SIZE * LUT_GROUPS))
15+
#define TEXEL_HALF float2(TEXEL_SIZE.xy / 2.0f)
16+
#define TEXEL_FIX TEXEL_SIZE.y * LUT_GROUPS
17+
18+
uniform float4 ssfx_lut;
19+
20+
float3 ssfx_lut_pp(float3 base_col)
21+
{
22+
// Prepare LUT UVs
23+
float3 cells = base_col * G_CELLS_SIZE - base_col;
24+
float lut_frac = frac(cells.b);
25+
cells.rg = TEXEL_HALF + cells.rg * TEXEL_SIZE;
26+
cells.r += (cells.b - lut_frac) * TEXEL_FIX;
27+
28+
// Final LUT UVs
29+
float4 uvs = float4(cells.rg, cells.r + TEXEL_FIX, cells.g);
30+
31+
// Group offset
32+
float2 grp_offset = float2(0.0, ssfx_lut.y / LUT_GROUPS);
33+
34+
// Sample LUTs
35+
float3 lut_col = lerp( s_lut_atlas.Sample(smp_linear, uvs.xy + grp_offset).rgb,
36+
s_lut_atlas.Sample(smp_linear, uvs.zw + grp_offset).rgb,
37+
lut_frac);
38+
39+
#ifdef G_ADVANCE_TRANSITION
40+
41+
// Group2 offset
42+
grp_offset = float2(0.0, ssfx_lut.z / LUT_GROUPS);
43+
44+
// Sample transition LUTs
45+
float3 SecondLUT = lerp(s_lut_atlas.Sample(smp_linear, uvs.xy + grp_offset).rgb,
46+
s_lut_atlas.Sample(smp_linear, uvs.zw + grp_offset).rgb,
47+
lut_frac);
48+
49+
lut_col = lerp(lut_col, SecondLUT, ssfx_lut.w);
50+
#endif
51+
52+
return lerp(base_col.rgb, lut_col.rgb, ssfx_lut.x);
53+
54+
}

0 commit comments

Comments
 (0)