ugly-game 0.14.30 → 0.14.32

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.
@@ -921,6 +921,15 @@ const ENV_SKY: f32 = 1.7;
921
921
  // And how much DARKER the faked ground is. Both ends are forced apart on purpose — see the note in fs
922
922
  // about an overcast scene where the ambient and the fog tint are the same colour.
923
923
  const ENV_GROUND: f32 = 0.3;
924
+ // ⚠️ A DELIBERATE MIP BIAS on the material texture only, and it is what lets a dense pattern actually
925
+ // be seen. The gradient handed to textureSampleGrad is what picks the mip, so shrinking it selects a
926
+ // SHARPER level than the footprint strictly warrants. Without it the grain hit a hard ceiling: 32
927
+ // lines around the body read, 44 and 64 both averaged away to flat skin in the mip chain long before
928
+ // they reached the eye, so raising the density made the material LESS visible rather than more.
929
+ //
930
+ // The cost is some shimmer on a distant character. That is the right trade here — the crowd drops to
931
+ // coarser rungs with distance anyway, and an invisible material is a worse defect than a busy one.
932
+ const MIP_SHARPEN: f32 = 0.55;
924
933
  // ⚠️ 1/MEAN (0.4615), NOT 1/p99, and getting that wrong is what made every desaturating material
925
934
  // look bad for three rounds. This gain feeds a MULTIPLICATIVE detail map, so what matters is that it
926
935
  // averages 1.0 - leaving the material's own colour and contrast alone while still modulating it.
@@ -955,7 +964,7 @@ const ENV_GROUND: f32 = 0.3;
955
964
  const MATS = array<vec4f, 15>(
956
965
  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),
957
966
  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),
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),
967
+ vec4f(0.90, 40.0, 0.80, 1.0), vec4f(1.00, 0.0, 0.120, 1.0), vec4f(0.00, 0.000, 0.0, 0.0),
959
968
  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),
960
969
  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),
961
970
  );
@@ -1074,9 +1083,9 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
1074
1083
  var matC = vec3f(1.0);
1075
1084
  if (i32(b.y) >= 0) {
1076
1085
  if (b.w > 0.5) {
1077
- matC = cylindrical(i32(b.y), i.rest * b.z, rdx * b.z, rdy * b.z);
1086
+ matC = cylindrical(i32(b.y), i.rest * b.z, rdx * b.z * MIP_SHARPEN, rdy * b.z * MIP_SHARPEN);
1078
1087
  } else {
1079
- matC = triplanar(i32(b.y), i.rest * b.z, rdx * b.z, rdy * b.z, bn);
1088
+ matC = triplanar(i32(b.y), i.rest * b.z, rdx * b.z * MIP_SHARPEN, rdy * b.z * MIP_SHARPEN, bn);
1080
1089
  }
1081
1090
  }
1082
1091
  let base = detail * matC * i.tint.rgb;
@@ -1118,7 +1127,11 @@ fn cylindrical(layer: i32, p: vec3f, dx: vec3f, dy: vec3f) -> vec3f {
1118
1127
  // REFLECTED ray rather than the normal, which is what makes the gradient sweep with the camera the
1119
1128
  // way a real reflection does.
1120
1129
  let rdir = reflect(-v, n);
1121
- let sky = clamp(rdir.y * 0.5 + 0.5, 0.0, 1.0);
1130
+ // ⚠️ SHARPENED with a smoothstep, because a linear ramp reads as something soft and FLOWING rather
1131
+ // than as metal. A real reflection has a horizon in it: the world above and the world below meet at
1132
+ // an edge, and the eye uses that hard transition to tell a mirror from a matte surface. Compressing
1133
+ // the ramp into the middle band puts that edge back.
1134
+ let sky = smoothstep(0.35, 0.62, clamp(rdir.y * 0.5 + 0.5, 0.0, 1.0));
1122
1135
  // ⚠️ The ground half is DARKENED, not taken as-is, and without that metal still read flat. In an
1123
1136
  // overcast scene the ambient and the fog tint are nearly the SAME pale grey, so mixing between them
1124
1137
  // gave a gradient with no range in it — exactly the lighting a white studio backdrop produces, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-game",
3
- "version": "0.14.30",
3
+ "version": "0.14.32",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {