ugly-game 0.14.26 → 0.14.28
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 -3
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -912,6 +912,12 @@ fn shadowFactor(world: vec3f, ndl: f32) -> f32 {
|
|
|
912
912
|
//
|
|
913
913
|
// ⚠️ Reachable only when desat > 0, so material 0 is unaffected by its value.
|
|
914
914
|
const LUMA_GAIN: f32 = 2.1670;
|
|
915
|
+
// How much of the normalised skin luminance survives into a desaturated material. Pores and creases,
|
|
916
|
+
// not the wearer skin tone - see the note in fs.
|
|
917
|
+
const DETAIL_STRENGTH: f32 = 0.35;
|
|
918
|
+
// How much brighter the faked sky is than the fog colour it is built from. A metal reflects nearly all
|
|
919
|
+
// of what hits it, so its environment has to be able to read brighter than the ambient floor.
|
|
920
|
+
const ENV_SKY: f32 = 1.7;
|
|
915
921
|
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
916
922
|
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
917
923
|
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
@@ -933,6 +939,10 @@ const LUMA_GAIN: f32 = 2.1670;
|
|
|
933
939
|
// it is why skin gets no sheen even though a little would flatter it. Giving skin a specular lobe
|
|
934
940
|
// is a separate decision that should be made by looking at it.
|
|
935
941
|
//
|
|
942
|
+
// ⚠️ Metal exponent 40, not 128. pow(ndh, 128) is a pinpoint lobe: on a curved body almost no
|
|
943
|
+
// fragment satisfies it, so the specular vanished and the whole figure was left as base x ambient —
|
|
944
|
+
// flat grey clay. A metal wants a BROAD sheen sweeping across the form, not a mirror glint.
|
|
945
|
+
//
|
|
936
946
|
// exp and scale are written as 1 on the rows that do not use them: a WGSL const array has no empty
|
|
937
947
|
// cell, and pow(0, 0) is a value nobody should have to reason about.
|
|
938
948
|
// b.w is the PROJECTION MODE for the material texture: 0 = triplanar, 1 = cylindrical about the
|
|
@@ -942,7 +952,7 @@ const LUMA_GAIN: f32 = 2.1670;
|
|
|
942
952
|
const MATS = array<vec4f, 15>(
|
|
943
953
|
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),
|
|
944
954
|
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),
|
|
945
|
-
vec4f(0.90,
|
|
955
|
+
vec4f(0.90, 40.0, 0.80, 1.0), vec4f(1.00, 0.0, 0.333, 0.0), vec4f(0.00, 0.000, 0.0, 0.0),
|
|
946
956
|
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),
|
|
947
957
|
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),
|
|
948
958
|
);
|
|
@@ -1028,7 +1038,18 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1028
1038
|
// desat 1 is pores, creases and anatomical shading - which is what makes a bronze figure read as
|
|
1029
1039
|
// a figure rather than as a smooth mannequin.
|
|
1030
1040
|
let skinS = textureSample(skinTex, skinSamp, i.uv, i.layer).rgb;
|
|
1031
|
-
|
|
1041
|
+
// ⚠️ A GENTLE MODULATION AROUND 1.0, not a full multiply, and this is the last of the reasons wood
|
|
1042
|
+
// looked wrong. LUMA_GAIN normalises against the mean over ALL TWELVE skin layers, but a character
|
|
1043
|
+
// wears ONE of them - and on layer 6, a dark-skinned atlas, the luminance sits far below that global
|
|
1044
|
+
// mean. Multiplying by it in full made the wooden figure inherit the darkness of the person
|
|
1045
|
+
// underneath: the same carving came out pale on one seed and dark brown on another, for a reason
|
|
1046
|
+
// nothing on screen could explain.
|
|
1047
|
+
//
|
|
1048
|
+
// A material's colour is its own. The skin map's job here is only to keep the pores and creases
|
|
1049
|
+
// that make a body read as a body, which DETAIL_STRENGTH of it is plenty for. Normalising per layer
|
|
1050
|
+
// instead would need twelve constants kept in step with the cook, for a subtler result.
|
|
1051
|
+
let lumaN = clamp(luma(skinS) * LUMA_GAIN, 0.35, 1.6);
|
|
1052
|
+
let detail = mix(skinS, vec3f(mix(1.0, lumaN, DETAIL_STRENGTH)), b.x);
|
|
1032
1053
|
// ⚠️ The blend normal comes from the DERIVATIVES of the interpolated rest position, not from any
|
|
1033
1054
|
// normal in a buffer. There is no bind-pose normal to bind - normals are recomputed after the
|
|
1034
1055
|
// morph from the adjacency arrays - and the post-morph normal ROTATES WITH THE LIMB, so using it
|
|
@@ -1083,7 +1104,21 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1083
1104
|
//
|
|
1084
1105
|
// Found by LOOKING at it. Every assertion in the GPU harness passed on the black version: it was
|
|
1085
1106
|
// view-dependent, it peaked on the mirror axis, it differed from every other row.
|
|
1086
|
-
|
|
1107
|
+
// ⚠️ A REFLECTED-RAY GRADIENT, not a flat ambient, and the flat version is why metal read as grey
|
|
1108
|
+
// clay. With metalness 1 the diffuse term is gone, so ALL the shading came from one constant times
|
|
1109
|
+
// the base colour — a uniform wash with no tonal variation anywhere on the body. What makes metal
|
|
1110
|
+
// look like metal is that its brightness sweeps as the surface turns, because it is reflecting a
|
|
1111
|
+
// world that is bright above and dark below.
|
|
1112
|
+
//
|
|
1113
|
+
// There is no environment map here, so the sky is faked from the two colours the uniform already
|
|
1114
|
+
// carries: the fog tint stands in for the sky and the ambient for the ground bounce. Keyed on the
|
|
1115
|
+
// REFLECTED ray rather than the normal, which is what makes the gradient sweep with the camera the
|
|
1116
|
+
// way a real reflection does.
|
|
1117
|
+
let rdir = reflect(-v, n);
|
|
1118
|
+
let sky = clamp(rdir.y * 0.5 + 0.5, 0.0, 1.0);
|
|
1119
|
+
let envCol = mix(u.amb.xyz, u.fog.xyz * ENV_SKY, sky);
|
|
1120
|
+
// Fresnel brightens a grazing reflection, which is the other half of the metal read.
|
|
1121
|
+
let env = base * a.w * envCol * (0.55 + 1.15 * clamp(fres, 0.0, 1.0));
|
|
1087
1122
|
let lit = base * (1.0 - a.w) * (u.amb.xyz + d * u.sunCol.xyz * sh) + env + spec;
|
|
1088
1123
|
|
|
1089
1124
|
let dist = length(i.world - u.cam.xyz);
|