ugly-game 0.5.11 → 0.5.12
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/gpuShadow.js +5 -3
- package/package.json +1 -1
package/dist/gpuShadow.js
CHANGED
|
@@ -260,13 +260,15 @@ fn blockShade(fx: f32, fz: f32) -> f32 {
|
|
|
260
260
|
var variant = 1u; // side
|
|
261
261
|
if (d > 0.5) { variant = 0u; } else if (d < -0.5) { variant = 2u; }
|
|
262
262
|
let rect = tileRects[u32(i.tile) * 3u + variant];
|
|
263
|
-
|
|
263
|
+
// INSET the per-block UV so it never samples the tile's edge texels — otherwise linear filtering bleeds into
|
|
264
|
+
// the neighbouring atlas tile at every block boundary, drawing a hard seam GRID. 4% inset kills the seam.
|
|
265
|
+
let uv = rect.xy + (fract(vec2(fx, fz)) * 0.92 + 0.04) * rect.zw;
|
|
264
266
|
let texc = textureSampleLevel(atlasTex, atlasSamp, uv, 0.0).rgb; // explicit LOD (early-return above makes control flow non-uniform)
|
|
265
267
|
base = mix(texc, texc * cam.tint.rgb, cam.tint.w); // per-planet tint
|
|
266
268
|
}
|
|
267
269
|
// per-block edge AO makes each voxel visible on FLAT-hue cubes, but reads as a hard GRID over textures — so the
|
|
268
|
-
// atlas path
|
|
269
|
-
let ao = select(blockShade(fx, fz),
|
|
270
|
+
// atlas path drops it entirely (the texture already supplies surface detail).
|
|
271
|
+
let ao = select(blockShade(fx, fz), 1.0, cam.atlas.x > 0.5 && i.tile >= 0.0);
|
|
270
272
|
let lit = base * (cam.sun.w + cam.sunCol.xyz * ndl * sh) * ao;
|
|
271
273
|
return vec4(pow(clamp(lit, vec3(0.0), vec3(1.0)), vec3(0.4545)), 1.0); // gamma
|
|
272
274
|
}
|