ugly-game 0.14.21 → 0.14.23
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 +19 -4
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -1103,15 +1103,30 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1103
1103
|
// clip-space heading; the y is negated because clip space runs +y UP and a texture's v runs
|
|
1104
1104
|
// DOWN. Getting that flip wrong bends the background the wrong way, which reads as glass with
|
|
1105
1105
|
// an odd tilt rather than as anything obviously broken.
|
|
1106
|
-
|
|
1106
|
+
// ⚠️ NORMALIZED, and it was not at first. viewProj applied to a DIRECTION (w = 0) has no
|
|
1107
|
+
// meaningful magnitude - it carries the projection's scale terms and the rebased world's units,
|
|
1108
|
+
// so it came out in the tens. Times a 0.045 screen offset that is a displacement of whole
|
|
1109
|
+
// screens, which clamp() then pinned to a CORNER of the copy: every glass fragment sampled the
|
|
1110
|
+
// same corner texel, and face-on - where the rim term is near zero and the background is
|
|
1111
|
+
// essentially all you see - the body rendered as a flat dark shape. Only the direction is wanted
|
|
1112
|
+
// here; c.y alone sets how far.
|
|
1113
|
+
let ndRaw = (u.viewProj * vec4f(n, 0.0)).xy;
|
|
1114
|
+
let ndLen = length(ndRaw);
|
|
1115
|
+
let nd = select(vec2f(0.0), ndRaw / ndLen, ndLen > 1e-6);
|
|
1107
1116
|
let off = vec2f(nd.x, -nd.y) * c.y;
|
|
1108
1117
|
// Clamped so a grazing fragment cannot reach outside the copy and smear its edge texel across
|
|
1109
1118
|
// the body.
|
|
1110
1119
|
let suv = clamp(here + off, vec2f(0.0), vec2f(1.0));
|
|
1111
1120
|
let behind = textureSampleLevel(sceneTex, skinSamp, suv, 0.0).rgb;
|
|
1112
|
-
//
|
|
1113
|
-
//
|
|
1114
|
-
|
|
1121
|
+
// ⚠️ TINTED BY THE COLOUR, NOT MULTIPLIED BY base, and that distinction is the whole
|
|
1122
|
+
// difference between glass and a dark blob. base carries the skin atlas's luminance detail -
|
|
1123
|
+
// around 0.5 - and running transmitted light through it halves everything seen through the body,
|
|
1124
|
+
// so the figure came out DARKER than the world behind it. Detail belongs to the surface shading;
|
|
1125
|
+
// what passes through a pane is attenuated only by the pane's own colour.
|
|
1126
|
+
let transmit = behind * i.tint.rgb;
|
|
1127
|
+
// The lit surface is then layered over it by the SAME fresnel rim that drove the alpha: clear in
|
|
1128
|
+
// the middle, bright at the edge.
|
|
1129
|
+
outCol = mix(transmit, lit, clamp(c.x * rim, 0.0, 1.0));
|
|
1115
1130
|
// ⚠️ ALPHA 1 once we have composited the background OURSELVES. The blended pipeline would
|
|
1116
1131
|
// otherwise mix our result with the UNDISTORTED scene underneath and half the refraction would
|
|
1117
1132
|
// be cancelled straight back out. The record still carries tint.w < 1, so splitByAlpha still
|