ugly-game 0.14.27 → 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 +23 -2
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -915,6 +915,9 @@ const LUMA_GAIN: f32 = 2.1670;
|
|
|
915
915
|
// How much of the normalised skin luminance survives into a desaturated material. Pores and creases,
|
|
916
916
|
// not the wearer skin tone - see the note in fs.
|
|
917
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;
|
|
918
921
|
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
919
922
|
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
920
923
|
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
@@ -936,6 +939,10 @@ const DETAIL_STRENGTH: f32 = 0.35;
|
|
|
936
939
|
// it is why skin gets no sheen even though a little would flatter it. Giving skin a specular lobe
|
|
937
940
|
// is a separate decision that should be made by looking at it.
|
|
938
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
|
+
//
|
|
939
946
|
// exp and scale are written as 1 on the rows that do not use them: a WGSL const array has no empty
|
|
940
947
|
// cell, and pow(0, 0) is a value nobody should have to reason about.
|
|
941
948
|
// b.w is the PROJECTION MODE for the material texture: 0 = triplanar, 1 = cylindrical about the
|
|
@@ -945,7 +952,7 @@ const DETAIL_STRENGTH: f32 = 0.35;
|
|
|
945
952
|
const MATS = array<vec4f, 15>(
|
|
946
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),
|
|
947
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),
|
|
948
|
-
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),
|
|
949
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),
|
|
950
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),
|
|
951
958
|
);
|
|
@@ -1097,7 +1104,21 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1097
1104
|
//
|
|
1098
1105
|
// Found by LOOKING at it. Every assertion in the GPU harness passed on the black version: it was
|
|
1099
1106
|
// view-dependent, it peaked on the mirror axis, it differed from every other row.
|
|
1100
|
-
|
|
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));
|
|
1101
1122
|
let lit = base * (1.0 - a.w) * (u.amb.xyz + d * u.sunCol.xyz * sh) + env + spec;
|
|
1102
1123
|
|
|
1103
1124
|
let dist = length(i.world - u.cam.xyz);
|