Fix distorted ground: bigger mosaic + stronger atmospheric fog

- GROUND_MOSAIC_SIZE 9 -> 16 (16x16 = 256 tiles, covers 16 world
  units instead of 9 — wider safety margin at the mosaic edge)
- Fog: tGround / 30 -> tGround / 12 with full mix (was 75% mix)
  so distant ground fully fades to sky instead of staying visible
  with wrong UVs (which was the source of the striped look)
- Result: visible ground content matches mosaic; far ground
  cleanly fades to sky, close ground shows clear satellite tiles
This commit is contained in:
Richard Zink committed 2026-10-07 20:53:59 +02:00
1 parent de471dcb8c
commit 043d2b689e
1 file changed
+3 -3
+3 -3
View File
@@ -205,8 +205,8 @@ var FRAG_SRC = [
'vec2 gUv = vec2(hitPoint.x, hitPoint.z);', 'vec2 gUv = vec2(hitPoint.x, hitPoint.z);',
'gUv = (gUv - uGroundCenter) / uGroundSize + 0.5;', 'gUv = (gUv - uGroundCenter) / uGroundSize + 0.5;',
'vec3 groundCol = texture2D(uGround, gUv).rgb;', 'vec3 groundCol = texture2D(uGround, gUv).rgb;',
'float fogAmount = clamp(tGround / 30.0, 0.0, 1.0);', 'float fogAmount = clamp(tGround / 12.0, 0.0, 1.0);',
'groundCol = mix(groundCol, uBg, fogAmount * 0.75);', 'groundCol = mix(groundCol, uBg, fogAmount);',
// Ground mask: full ground when looking down, none when up. // Ground mask: full ground when looking down, none when up.
'float gmask = (tGround > 0.0) ? smoothstep(0.0, -0.30, rd.y) : 0.0;', 'float gmask = (tGround > 0.0) ? smoothstep(0.0, -0.30, rd.y) : 0.0;',
'col = mix(col, groundCol, gmask);', 'col = mix(col, groundCol, gmask);',
@@ -269,7 +269,7 @@ function init(canvas) {
var GROUND_TILE_URL = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/'; var GROUND_TILE_URL = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/';
var GROUND_TILE_Z = 11; var GROUND_TILE_Z = 11;
var GROUND_TILE_SIZE = 256; var GROUND_TILE_SIZE = 256;
var GROUND_MOSAIC_SIZE = 9; // 9x9 tiles around the camera var GROUND_MOSAIC_SIZE = 16; // 16x16 tiles around the camera
var GROUND_BUFFER_TILES = 2; // refetch when this close to edge var GROUND_BUFFER_TILES = 2; // refetch when this close to edge
// Passau tile at zoom 11 // Passau tile at zoom 11
var GROUND_BASE_X = 1102; var GROUND_BASE_X = 1102;