ugly-game 0.14.25 → 0.14.27
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 +27 -2
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -911,7 +911,21 @@ 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
|
+
// 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
|
+
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
919
|
+
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
920
|
+
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
921
|
+
// Normalising by p99 keeps every value under 1, which sounds like the safe choice and is not: the
|
|
922
|
+
// mean then lands near 0.5, so wood, metal and glass all drew at HALF brightness with half the
|
|
923
|
+
// contrast of whatever they multiplied. Wood arrived as flat dark brown with its grain invisible, and
|
|
924
|
+
// three separate rewrites of the TEXTURE chased a defect that was never in the texture.
|
|
925
|
+
//
|
|
926
|
+
// ⚠️ The clamp band is [0.35, 1.6], not [0, 1]. At this gain a mid skin texel already reaches 1.0, so
|
|
927
|
+
// clamping at 1 would flatten the entire bright half of the map back into a constant - reintroducing
|
|
928
|
+
// the same loss from the other direction. A detail map has to be allowed above 1 to modulate upward.
|
|
915
929
|
// ONE ROW PER MATERIAL, two vec4s each: (spec, exponent, fresnel, metal) then
|
|
916
930
|
// (desat, texture layer, tile scale, pad).
|
|
917
931
|
//
|
|
@@ -1017,7 +1031,18 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1017
1031
|
// desat 1 is pores, creases and anatomical shading - which is what makes a bronze figure read as
|
|
1018
1032
|
// a figure rather than as a smooth mannequin.
|
|
1019
1033
|
let skinS = textureSample(skinTex, skinSamp, i.uv, i.layer).rgb;
|
|
1020
|
-
|
|
1034
|
+
// ⚠️ A GENTLE MODULATION AROUND 1.0, not a full multiply, and this is the last of the reasons wood
|
|
1035
|
+
// looked wrong. LUMA_GAIN normalises against the mean over ALL TWELVE skin layers, but a character
|
|
1036
|
+
// wears ONE of them - and on layer 6, a dark-skinned atlas, the luminance sits far below that global
|
|
1037
|
+
// mean. Multiplying by it in full made the wooden figure inherit the darkness of the person
|
|
1038
|
+
// underneath: the same carving came out pale on one seed and dark brown on another, for a reason
|
|
1039
|
+
// nothing on screen could explain.
|
|
1040
|
+
//
|
|
1041
|
+
// A material's colour is its own. The skin map's job here is only to keep the pores and creases
|
|
1042
|
+
// that make a body read as a body, which DETAIL_STRENGTH of it is plenty for. Normalising per layer
|
|
1043
|
+
// instead would need twelve constants kept in step with the cook, for a subtler result.
|
|
1044
|
+
let lumaN = clamp(luma(skinS) * LUMA_GAIN, 0.35, 1.6);
|
|
1045
|
+
let detail = mix(skinS, vec3f(mix(1.0, lumaN, DETAIL_STRENGTH)), b.x);
|
|
1021
1046
|
// ⚠️ The blend normal comes from the DERIVATIVES of the interpolated rest position, not from any
|
|
1022
1047
|
// normal in a buffer. There is no bind-pose normal to bind - normals are recomputed after the
|
|
1023
1048
|
// morph from the adjacency arrays - and the post-morph normal ROTATES WITH THE LIMB, so using it
|