BlueGit

timfa questward

Files

questward / client / src / play / waterDebug.js

waterDebug.js

waterDebug.js 2.6 KiB Download Raw
1/**
2 * Procedural water / lava shader defaults and uniform bags.
3 * (Debug panel removed after tune-in.)
4 */
5
6export const DEFAULT_WATER_DEBUG = Object.freeze({
7 flowX: 0.17,
8 flowY: 0.05,
9 flowZ: 0.91,
10 waveScale: 2.07,
11 fbmAmp: 0.15,
12 texAmp: 0.43,
13 distort: 0.09,
14 normalZ: 0.88,
15 waveGain: 0.62,
16 crestLo: 0.54,
17 crestHi: 0.67,
18 crestPow: 2.05,
19 glitterPow: 13.1,
20 crestGlitter: 1.3,
21 glitterCap: 1,
22 glitterMix: 1.24,
23 shadeLo: 1.06,
24 shadeHi: 1,
25 bodyLo: 0.41,
26 bodyHi: 0.85,
27 litLo: 0.5,
28 litHi: 0.86,
29 litMix: 0.46,
30 edgeDark: 0.37,
31 lightDirX: -0.48,
32 lightDirY: -0.63,
33 lightDirZ: 0.78,
34 normalEps: 0.21,
35 foamStrength: 1,
36 shoreClip: 0.55,
37 deepDark: 0.4,
38 deepAbrupt: 0.72
39});
40
41export const DEFAULT_LAVA_DEBUG = Object.freeze({
42 flowX: 0.08,
43 flowY: 0.04,
44 flowZ: 0.13,
45 waveScale: 1.83,
46 fbmAmp: 0.43,
47 texAmp: 0.3,
48 distort: 0.3,
49 normalZ: 1.07,
50 waveGain: 0.52,
51 crestLo: 0.57,
52 crestHi: 0.71,
53 crestPow: 1.15,
54 glitterPow: 7.5,
55 crestGlitter: 1.19,
56 glitterCap: 0.31,
57 glitterMix: 0.51,
58 shadeLo: 0.88,
59 shadeHi: 1.07,
60 bodyLo: 0.05,
61 bodyHi: 1,
62 litLo: 0.59,
63 litHi: 0.74,
64 litMix: 1,
65 edgeDark: 1,
66 lightDirX: -0.48,
67 lightDirY: -0.63,
68 lightDirZ: 0.78,
69 normalEps: 0.09,
70 bloomStrength: 0.9,
71 shoreClip: 0.9
72});
73
74function uniformBagFrom (p, extras = {})
75{
76 return {
77 u_flowX: p.flowX,
78 u_flowY: p.flowY,
79 u_flowZ: p.flowZ,
80 u_waveScale: p.waveScale,
81 u_fbmAmp: p.fbmAmp,
82 u_texAmp: p.texAmp,
83 u_distort: p.distort,
84 u_normalZ: p.normalZ,
85 u_waveGain: p.waveGain,
86 u_crestLo: p.crestLo,
87 u_crestHi: p.crestHi,
88 u_crestPow: p.crestPow,
89 u_glitterPow: p.glitterPow,
90 u_crestGlitter: p.crestGlitter,
91 u_glitterCap: p.glitterCap,
92 u_glitterMix: p.glitterMix,
93 u_shadeLo: p.shadeLo,
94 u_shadeHi: p.shadeHi,
95 u_bodyLo: p.bodyLo,
96 u_bodyHi: p.bodyHi,
97 u_litLo: p.litLo,
98 u_litHi: p.litHi,
99 u_litMix: p.litMix,
100 u_edgeDark: p.edgeDark,
101 u_lightDirX: p.lightDirX,
102 u_lightDirY: p.lightDirY,
103 u_lightDirZ: p.lightDirZ,
104 u_normalEps: p.normalEps,
105 ...extras
106 };
107}
108
109/** Uniform bag for the water ground fragment shader. */
110const WATER_DEBUG_UNIFORMS = Object.freeze(uniformBagFrom(DEFAULT_WATER_DEBUG, {
111 u_foamStrength: DEFAULT_WATER_DEBUG.foamStrength,
112 u_shoreClip: DEFAULT_WATER_DEBUG.shoreClip,
113 u_deepDark: DEFAULT_WATER_DEBUG.deepDark,
114 u_deepAbrupt: DEFAULT_WATER_DEBUG.deepAbrupt
115}));
116
117/** Uniform bag for lava ground / bloom shaders. */
118const LAVA_DEBUG_UNIFORMS = Object.freeze(uniformBagFrom(DEFAULT_LAVA_DEBUG, {
119 u_bloomStrength: DEFAULT_LAVA_DEBUG.bloomStrength,
120 u_shoreClip: DEFAULT_LAVA_DEBUG.shoreClip
121}));
122
123export function waterDebugUniforms ()
124{
125 return WATER_DEBUG_UNIFORMS;
126}
127
128export function lavaDebugUniforms ()
129{
130 return LAVA_DEBUG_UNIFORMS;
131}