ugly-game 0.14.27 → 0.14.29
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 +31 -2
- package/package.json +1 -1
package/dist/assets/gpuCrowd.js
CHANGED
|
@@ -915,6 +915,12 @@ 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;
|
|
921
|
+
// And how much DARKER the faked ground is. Both ends are forced apart on purpose — see the note in fs
|
|
922
|
+
// about an overcast scene where the ambient and the fog tint are the same colour.
|
|
923
|
+
const ENV_GROUND: f32 = 0.3;
|
|
918
924
|
// ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
|
|
919
925
|
// look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
|
|
920
926
|
// averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
|
|
@@ -936,6 +942,10 @@ const DETAIL_STRENGTH: f32 = 0.35;
|
|
|
936
942
|
// it is why skin gets no sheen even though a little would flatter it. Giving skin a specular lobe
|
|
937
943
|
// is a separate decision that should be made by looking at it.
|
|
938
944
|
//
|
|
945
|
+
// ⚠️ Metal exponent 40, not 128. pow(ndh, 128) is a pinpoint lobe: on a curved body almost no
|
|
946
|
+
// fragment satisfies it, so the specular vanished and the whole figure was left as base x ambient —
|
|
947
|
+
// flat grey clay. A metal wants a BROAD sheen sweeping across the form, not a mirror glint.
|
|
948
|
+
//
|
|
939
949
|
// exp and scale are written as 1 on the rows that do not use them: a WGSL const array has no empty
|
|
940
950
|
// cell, and pow(0, 0) is a value nobody should have to reason about.
|
|
941
951
|
// b.w is the PROJECTION MODE for the material texture: 0 = triplanar, 1 = cylindrical about the
|
|
@@ -945,7 +955,7 @@ const DETAIL_STRENGTH: f32 = 0.35;
|
|
|
945
955
|
const MATS = array<vec4f, 15>(
|
|
946
956
|
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
957
|
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,
|
|
958
|
+
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
959
|
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
960
|
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
961
|
);
|
|
@@ -1097,7 +1107,26 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
|
|
|
1097
1107
|
//
|
|
1098
1108
|
// Found by LOOKING at it. Every assertion in the GPU harness passed on the black version: it was
|
|
1099
1109
|
// view-dependent, it peaked on the mirror axis, it differed from every other row.
|
|
1100
|
-
|
|
1110
|
+
// ⚠️ A REFLECTED-RAY GRADIENT, not a flat ambient, and the flat version is why metal read as grey
|
|
1111
|
+
// clay. With metalness 1 the diffuse term is gone, so ALL the shading came from one constant times
|
|
1112
|
+
// the base colour — a uniform wash with no tonal variation anywhere on the body. What makes metal
|
|
1113
|
+
// look like metal is that its brightness sweeps as the surface turns, because it is reflecting a
|
|
1114
|
+
// world that is bright above and dark below.
|
|
1115
|
+
//
|
|
1116
|
+
// There is no environment map here, so the sky is faked from the two colours the uniform already
|
|
1117
|
+
// carries: the fog tint stands in for the sky and the ambient for the ground bounce. Keyed on the
|
|
1118
|
+
// REFLECTED ray rather than the normal, which is what makes the gradient sweep with the camera the
|
|
1119
|
+
// way a real reflection does.
|
|
1120
|
+
let rdir = reflect(-v, n);
|
|
1121
|
+
let sky = clamp(rdir.y * 0.5 + 0.5, 0.0, 1.0);
|
|
1122
|
+
// ⚠️ The ground half is DARKENED, not taken as-is, and without that metal still read flat. In an
|
|
1123
|
+
// overcast scene the ambient and the fog tint are nearly the SAME pale grey, so mixing between them
|
|
1124
|
+
// gave a gradient with no range in it — exactly the lighting a white studio backdrop produces, and
|
|
1125
|
+
// the one the lab opens in. Forcing the down-facing end dark guarantees the tonal sweep that makes
|
|
1126
|
+
// a surface read as reflective whatever the scene is doing.
|
|
1127
|
+
let envCol = mix(u.amb.xyz * ENV_GROUND, u.fog.xyz * ENV_SKY, sky);
|
|
1128
|
+
// Fresnel brightens a grazing reflection, which is the other half of the metal read.
|
|
1129
|
+
let env = base * a.w * envCol * (0.55 + 1.15 * clamp(fres, 0.0, 1.0));
|
|
1101
1130
|
let lit = base * (1.0 - a.w) * (u.amb.xyz + d * u.sunCol.xyz * sh) + env + spec;
|
|
1102
1131
|
|
|
1103
1132
|
let dist = length(i.world - u.cam.xyz);
|