ugly-game 0.14.24 → 0.14.26
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 +38 -16
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -911,7 +911,18 @@ fn shadowFactor(world: vec3f, ndl: f32) -> f32 {
|
|
|
911
911
|
// should not set the gain for twelve whole bodies.
|
|
912
912
|
//
|
|
913
913
|
// ⚠️ Reachable only when desat > 0, so material 0 is unaffected by its value.
|
|
914
|
-
const LUMA_GAIN: f32 =
|
|
914
|
+
const LUMA_GAIN: f32 = 2.1670;
|
|
915
|
+
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
916
|
+
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
917
|
+
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
918
|
+
// Normalising by p99 keeps every value under 1, which sounds like the safe choice and is not: the
|
|
919
|
+
// mean then lands near 0.5, so wood, metal and glass all drew at HALF brightness with half the
|
|
920
|
+
// contrast of whatever they multiplied. Wood arrived as flat dark brown with its grain invisible, and
|
|
921
|
+
// three separate rewrites of the TEXTURE chased a defect that was never in the texture.
|
|
922
|
+
//
|
|
923
|
+
// ⚠️ The clamp band is [0.35, 1.6], not [0, 1]. At this gain a mid skin texel already reaches 1.0, so
|
|
924
|
+
// clamping at 1 would flatten the entire bright half of the map back into a constant - reintroducing
|
|
925
|
+
// the same loss from the other direction. A detail map has to be allowed above 1 to modulate upward.
|
|
915
926
|
// ONE ROW PER MATERIAL, two vec4s each: (spec, exponent, fresnel, metal) then
|
|
916
927
|
// (desat, texture layer, tile scale, pad).
|
|
917
928
|
//
|
|
@@ -933,15 +944,16 @@ const MATS = array<vec4f, 15>(
|
|
|
933
944
|
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),
|
|
934
945
|
vec4f(0.90, 128.0, 0.80, 1.0), vec4f(1.00, 0.0, 0.333, 0.0), vec4f(0.00, 0.000, 0.0, 0.0),
|
|
935
946
|
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),
|
|
936
|
-
vec4f(0.08, 16.0, 0.15, 0.0), vec4f(1.00, 1.0, 0.
|
|
947
|
+
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),
|
|
937
948
|
);
|
|
938
949
|
// ⚠️ Wood's tile scale is 0.22, not 0.5, and that was set by LOOKING. A shipped human stands ~16.6
|
|
939
950
|
// kit units, so 0.5 repeats the grain about eight times head to foot — fine enough that at any
|
|
940
951
|
// normal camera distance it averages into a flat tan and the character reads as bare skin. 0.22 is
|
|
941
|
-
// closer to four repeats, which is a plank rather than a veneer.
|
|
942
|
-
//
|
|
943
|
-
//
|
|
944
|
-
// no
|
|
952
|
+
// closer to four repeats, which is a plank rather than a veneer. Then 0.30 when wood went
|
|
953
|
+
// CYLINDRICAL, and now 0.12 - because the cylindrical mapping's across-the-body axis is an ANGLE,
|
|
954
|
+
// which is scale-INVARIANT (one turn is one repeat however the position is scaled). So this number
|
|
955
|
+
// no longer sets the grain's fineness at all; it only sets how many repeats run up the HEIGHT, and
|
|
956
|
+
// fewer means longer, more coherent grain lines. Wood grain runs long.
|
|
945
957
|
fn luma(c: vec3f) -> f32 { return dot(c, vec3f(0.2126, 0.7152, 0.0722)); }
|
|
946
958
|
// TRIPLANAR: three samples of the same tiling map, blended by the bind-space normal.
|
|
947
959
|
//
|
|
@@ -979,17 +991,27 @@ fn triplanar(layer: i32, p: vec3f, dx: vec3f, dy: vec3f, n: vec3f) -> vec3f {
|
|
|
979
991
|
// around the trunk and the fibre runs the length of it, exactly as in the log the figure came from.
|
|
980
992
|
// Same bind-space trick the hair's uvs2 uses, and for the same reason.
|
|
981
993
|
fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
982
|
-
|
|
983
|
-
//
|
|
984
|
-
//
|
|
985
|
-
// is
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
994
|
+
// ⚠️ THE ANGLE AROUND THE AXIS, NOT THE RADIUS, and using the radius is why the first cylindrical
|
|
995
|
+
// wood looked flat. On a limb the visible face sits at a nearly CONSTANT radius, so a radial
|
|
996
|
+
// coordinate barely moves across the surface you are looking at - and the texture's fine axis,
|
|
997
|
+
// which is what carries the grain, therefore produced almost no variation at all. The body came
|
|
998
|
+
// out smooth tan with a hint of striping.
|
|
999
|
+
//
|
|
1000
|
+
// Angle moves right across a limb, so the fine axis becomes visible detail: grain lines that run
|
|
1001
|
+
// the length of the figure and change as you go around it. This is the hair's uvs2 mapping, for
|
|
1002
|
+
// the same reason it was chosen there.
|
|
1003
|
+
let r2 = dot(p.xz, p.xz);
|
|
1004
|
+
let theta = atan2(p.z, p.x) * 0.15915494 + 0.5; // 1/(2*pi)
|
|
1005
|
+
// ⚠️ ANALYTIC gradient, not dpdx of the angle. atan2 jumps by a full turn at +/-pi, and a screen
|
|
1006
|
+
// derivative taken across that jump is enormous - it would select the coarsest mip along a seam
|
|
1007
|
+
// line down the body. d(theta)/ds = (x*dz - z*dx) / (x^2 + z^2), which is continuous everywhere
|
|
1008
|
+
// off the axis. The sampler repeats, so the VALUE wrapping is harmless once the gradient is right.
|
|
1009
|
+
let gx = select(0.0, (p.x * dx.z - p.z * dx.x) / r2 * 0.15915494, r2 > 1e-12);
|
|
1010
|
+
let gy = select(0.0, (p.x * dy.z - p.z * dy.x) / r2 * 0.15915494, r2 > 1e-12);
|
|
989
1011
|
return textureSampleGrad(
|
|
990
1012
|
matTex, skinSamp,
|
|
991
|
-
vec2f(p.y,
|
|
992
|
-
vec2f(dx.y,
|
|
1013
|
+
vec2f(p.y, theta), layer,
|
|
1014
|
+
vec2f(dx.y, gx), vec2f(dy.y, gy),
|
|
993
1015
|
).rgb;
|
|
994
1016
|
}
|
|
995
1017
|
@fragment fn fs(i: VOut) -> @location(0) vec4f {
|
|
@@ -1006,7 +1028,7 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1006
1028
|
// desat 1 is pores, creases and anatomical shading - which is what makes a bronze figure read as
|
|
1007
1029
|
// a figure rather than as a smooth mannequin.
|
|
1008
1030
|
let skinS = textureSample(skinTex, skinSamp, i.uv, i.layer).rgb;
|
|
1009
|
-
let detail = mix(skinS, vec3f(clamp(luma(skinS) * LUMA_GAIN, 0.
|
|
1031
|
+
let detail = mix(skinS, vec3f(clamp(luma(skinS) * LUMA_GAIN, 0.35, 1.6)), b.x);
|
|
1010
1032
|
// ⚠️ The blend normal comes from the DERIVATIVES of the interpolated rest position, not from any
|
|
1011
1033
|
// normal in a buffer. There is no bind-pose normal to bind - normals are recomputed after the
|
|
1012
1034
|
// morph from the adjacency arrays - and the post-morph normal ROTATES WITH THE LIMB, so using it
|