ugly-game 0.15.70 → 0.15.71

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.
@@ -345,8 +345,14 @@ fn linearToSrgb(c: vec3<f32>) -> vec3<f32> {
345
345
  if(mtl.maps.x>0.5) {
346
346
  let T=cross(py,N)*tx.x+cross(N,px)*ty.x;
347
347
  let B=cross(py,N)*tx.y+cross(N,px)*ty.y;
348
- let inv=inverseSqrt(max(max(dot(T,T),dot(B,B)),0.000001));
349
- N=normalize(N*mapN.z+(T*mapN.x+B*mapN.y)*inv*mtl.maps.z);
348
+ // Both derivatives shrink with the pixel footprint. A fixed floor on
349
+ // the frame length erases relief as the camera approaches the surface.
350
+ let frameLength2=max(dot(T,T),dot(B,B));
351
+ if (frameLength2 > 1e-28) {
352
+ let orientation=sign(dot(px,cross(py,N)));
353
+ let gradient=(T*mapN.x+B*mapN.y)*(orientation*inverseSqrt(frameLength2));
354
+ N=normalize(N*mapN.z+gradient*mtl.maps.z);
355
+ }
350
356
  }
351
357
  let ff = select(1.0, 0.5 + 0.85 * fixedFill(N, u.up.xyz), u.up.w > 0.5); // fixed fill (fall back to flat amb if no up)
352
358
  let d = clamp(dot(N, -normalize(u.sun.xyz)), 0.0, 1.0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-game",
3
- "version": "0.15.70",
3
+ "version": "0.15.71",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {