ugly-game 0.14.26 → 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 +15 -1
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -912,6 +912,9 @@ 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;
|
|
915
918
|
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
916
919
|
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
917
920
|
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
@@ -1028,7 +1031,18 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1028
1031
|
// desat 1 is pores, creases and anatomical shading - which is what makes a bronze figure read as
|
|
1029
1032
|
// a figure rather than as a smooth mannequin.
|
|
1030
1033
|
let skinS = textureSample(skinTex, skinSamp, i.uv, i.layer).rgb;
|
|
1031
|
-
|
|
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);
|
|
1032
1046
|
// ⚠️ The blend normal comes from the DERIVATIVES of the interpolated rest position, not from any
|
|
1033
1047
|
// normal in a buffer. There is no bind-pose normal to bind - normals are recomputed after the
|
|
1034
1048
|
// morph from the adjacency arrays - and the post-morph normal ROTATES WITH THE LIMB, so using it
|