ugly-game 0.14.33 → 0.14.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/gpuCrowd.js +33 -1
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -82,6 +82,10 @@ export const CROWD_MATERIAL_COUNT = 5;
|
|
|
82
82
|
*/
|
|
83
83
|
export const REFRACTING_MATERIALS = new Set([
|
|
84
84
|
CROWD_MATERIALS.glass,
|
|
85
|
+
// ⚠️ METAL TOO, since it became liquid. It reads the same scene copy along the REFLECTED ray
|
|
86
|
+
// instead of the refracted one — a mirror rather than a window — and a row left out of this set
|
|
87
|
+
// gets the 1×1 dummy bound and silently reflects nothing at all.
|
|
88
|
+
CROWD_MATERIALS.metal,
|
|
85
89
|
]);
|
|
86
90
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
87
91
|
// PURE ARITHMETIC. Everything below this line down to the WGSL is a plain function over plain
|
|
@@ -933,6 +937,9 @@ const ENV_GROUND: f32 = 0.55;
|
|
|
933
937
|
// The cost is some shimmer on a distant character. That is the right trade here — the crowd drops to
|
|
934
938
|
// coarser rungs with distance anyway, and an invisible material is a worse defect than a busy one.
|
|
935
939
|
const MIP_SHARPEN: f32 = 0.55;
|
|
940
|
+
// How much of a mirror material is the REFLECTED WORLD rather than its own shaded surface. Mercury is
|
|
941
|
+
// almost entirely the former — that is the whole read.
|
|
942
|
+
const MIRROR_MIX: f32 = 0.88;
|
|
936
943
|
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
937
944
|
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
938
945
|
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
@@ -967,7 +974,7 @@ const MIP_SHARPEN: f32 = 0.55;
|
|
|
967
974
|
const MATS = array<vec4f, 15>(
|
|
968
975
|
vec4f(0.00, 1.0, 0.00, 0.0), vec4f(0.00, -1.0, 1.000, 0.0), vec4f(0.00, 0.000, 0.0, 0.0),
|
|
969
976
|
vec4f(0.35, 64.0, 0.50, 0.0), vec4f(0.60, -1.0, 1.000, 0.0), vec4f(0.00, 0.000, 0.0, 0.0),
|
|
970
|
-
vec4f(
|
|
977
|
+
vec4f(1.00, 220.0, 1.00, 1.0), vec4f(1.00, -1.0, 1.000, 0.0), vec4f(0.00, 0.000, 0.075, 0.0),
|
|
971
978
|
vec4f(0.90, 256.0, 1.00, 0.0), vec4f(1.00, -1.0, 1.000, 0.0), vec4f(1.00, 0.045, 0.0, 0.0),
|
|
972
979
|
vec4f(0.08, 16.0, 0.15, 0.0), vec4f(1.00, 1.0, 0.120, 1.0), vec4f(0.00, 0.000, 0.0, 0.0),
|
|
973
980
|
);
|
|
@@ -1165,6 +1172,31 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1165
1172
|
var alpha = clamp(mix(i.tint.w, 1.0, c.x * rim), 0.0, 1.0);
|
|
1166
1173
|
var outCol = lit;
|
|
1167
1174
|
|
|
1175
|
+
// ── SCREEN-SPACE REFLECTION — liquid metal ────────────────────────────────
|
|
1176
|
+
//
|
|
1177
|
+
// ⚠️ GATED ON c.z, which is zero on every row but metal, so nothing else reaches the sample. The
|
|
1178
|
+
// same scene copy glass already needed, read along the REFLECTED ray instead of the surface normal
|
|
1179
|
+
// and composited opaquely — mercury is a mirror, not a window.
|
|
1180
|
+
//
|
|
1181
|
+
// What makes liquid metal read as liquid is that almost all of what you see is the WORLD, not the
|
|
1182
|
+
// surface. So the reflection is mixed in near-fully and the shaded term survives only as a floor,
|
|
1183
|
+
// rather than the other way round.
|
|
1184
|
+
if (c.z > 0.0 && u.csm.w > 0.5) {
|
|
1185
|
+
let vp = vec2f(max(u.csm.y, 1.0), max(u.csm.z, 1.0));
|
|
1186
|
+
let here = i.pos.xy / vp;
|
|
1187
|
+
// The REFLECTED ray's heading on screen. Same normalize-then-scale discipline the refraction
|
|
1188
|
+
// path needed: a clip-space direction has no meaningful magnitude of its own.
|
|
1189
|
+
let rrRaw = (u.viewProj * vec4f(rdir, 0.0)).xy;
|
|
1190
|
+
let rrLen = length(rrRaw);
|
|
1191
|
+
let rr = select(vec2f(0.0), rrRaw / rrLen, rrLen > 1e-6);
|
|
1192
|
+
let ruv = clamp(here + vec2f(rr.x, -rr.y) * c.z, vec2f(0.0), vec2f(1.0));
|
|
1193
|
+
let mirror = textureSampleLevel(sceneTex, skinSamp, ruv, 0.0).rgb;
|
|
1194
|
+
// Tinted by the metal's own colour, and brightened at grazing angles — a mirror reflects nearly
|
|
1195
|
+
// everything head-on and effectively all of it at the rim.
|
|
1196
|
+
let refl = mirror * base * (1.0 + fres);
|
|
1197
|
+
outCol = mix(lit, refl, MIRROR_MIX) + spec;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1168
1200
|
// ── REFRACTION ────────────────────────────────────────────────────────────
|
|
1169
1201
|
//
|
|
1170
1202
|
// ⚠️ GATED ON c.y, WHICH IS ZERO ON EVERY ROW BUT GLASS. Nothing else reaches the sample, so a
|