ugly-game 0.14.24 → 0.14.25
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 +25 -14
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -933,15 +933,16 @@ const MATS = array<vec4f, 15>(
|
|
|
933
933
|
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
934
|
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
935
|
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.
|
|
936
|
+
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
937
|
);
|
|
938
938
|
// ⚠️ Wood's tile scale is 0.22, not 0.5, and that was set by LOOKING. A shipped human stands ~16.6
|
|
939
939
|
// kit units, so 0.5 repeats the grain about eight times head to foot — fine enough that at any
|
|
940
940
|
// 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
|
|
941
|
+
// closer to four repeats, which is a plank rather than a veneer. Then 0.30 when wood went
|
|
942
|
+
// CYLINDRICAL, and now 0.12 - because the cylindrical mapping's across-the-body axis is an ANGLE,
|
|
943
|
+
// which is scale-INVARIANT (one turn is one repeat however the position is scaled). So this number
|
|
944
|
+
// no longer sets the grain's fineness at all; it only sets how many repeats run up the HEIGHT, and
|
|
945
|
+
// fewer means longer, more coherent grain lines. Wood grain runs long.
|
|
945
946
|
fn luma(c: vec3f) -> f32 { return dot(c, vec3f(0.2126, 0.7152, 0.0722)); }
|
|
946
947
|
// TRIPLANAR: three samples of the same tiling map, blended by the bind-space normal.
|
|
947
948
|
//
|
|
@@ -979,17 +980,27 @@ fn triplanar(layer: i32, p: vec3f, dx: vec3f, dy: vec3f, n: vec3f) -> vec3f {
|
|
|
979
980
|
// around the trunk and the fibre runs the length of it, exactly as in the log the figure came from.
|
|
980
981
|
// Same bind-space trick the hair's uvs2 uses, and for the same reason.
|
|
981
982
|
fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
982
|
-
|
|
983
|
-
//
|
|
984
|
-
//
|
|
985
|
-
// is
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
983
|
+
// ⚠️ THE ANGLE AROUND THE AXIS, NOT THE RADIUS, and using the radius is why the first cylindrical
|
|
984
|
+
// wood looked flat. On a limb the visible face sits at a nearly CONSTANT radius, so a radial
|
|
985
|
+
// coordinate barely moves across the surface you are looking at - and the texture's fine axis,
|
|
986
|
+
// which is what carries the grain, therefore produced almost no variation at all. The body came
|
|
987
|
+
// out smooth tan with a hint of striping.
|
|
988
|
+
//
|
|
989
|
+
// Angle moves right across a limb, so the fine axis becomes visible detail: grain lines that run
|
|
990
|
+
// the length of the figure and change as you go around it. This is the hair's uvs2 mapping, for
|
|
991
|
+
// the same reason it was chosen there.
|
|
992
|
+
let r2 = dot(p.xz, p.xz);
|
|
993
|
+
let theta = atan2(p.z, p.x) * 0.15915494 + 0.5; // 1/(2*pi)
|
|
994
|
+
// ⚠️ ANALYTIC gradient, not dpdx of the angle. atan2 jumps by a full turn at +/-pi, and a screen
|
|
995
|
+
// derivative taken across that jump is enormous - it would select the coarsest mip along a seam
|
|
996
|
+
// line down the body. d(theta)/ds = (x*dz - z*dx) / (x^2 + z^2), which is continuous everywhere
|
|
997
|
+
// off the axis. The sampler repeats, so the VALUE wrapping is harmless once the gradient is right.
|
|
998
|
+
let gx = select(0.0, (p.x * dx.z - p.z * dx.x) / r2 * 0.15915494, r2 > 1e-12);
|
|
999
|
+
let gy = select(0.0, (p.x * dy.z - p.z * dy.x) / r2 * 0.15915494, r2 > 1e-12);
|
|
989
1000
|
return textureSampleGrad(
|
|
990
1001
|
matTex, skinSamp,
|
|
991
|
-
vec2f(p.y,
|
|
992
|
-
vec2f(dx.y,
|
|
1002
|
+
vec2f(p.y, theta), layer,
|
|
1003
|
+
vec2f(dx.y, gx), vec2f(dy.y, gy),
|
|
993
1004
|
).rgb;
|
|
994
1005
|
}
|
|
995
1006
|
@fragment fn fs(i: VOut) -> @location(0) vec4f {
|