2.5 KiB
KAMAZ OSM Snow Tile Visibility And Persistence
Date: 2026-06-01
Project: garage
Repo: C:\git\kamaz5360
Problem
On the OSM Tverskaya snow test map, detailed snow tiles disappeared in the distance. The first instinct was to increase ActiveTileRadius so the player could see changed snow 500 m away, but with 10 m tiles that would require thousands of active procedural mesh components and would hurt performance.
A second bug made the OSM snow mask disappear after saving/loading the generated level: the mask worked during the setup commandlet but not after opening the .umap.
Symptoms
- Distant snow tiles disappear while driving.
- Cleaned snow and snowdrifts may not be visible after a dirty tile unloads.
- If the snow mask is not serialized, snow is no longer constrained to roads/sidewalks on reload.
- OSM maps can stutter when per-stamp snow logs print every frame.
Solution
Use a two-layer snow visualization:
- A coarse OSM road/sidewalk background snow mesh for distant continuity.
- Detailed active procedural tile meshes around the truck for wheel tracks, plow cuts, brush cleaning, and snowdrift volume.
When a dirty detailed tile unloads, keep a low-poly far visual copy of that tile. This preserves the visible result of cleared snow and pushed snowdrifts without keeping the full detailed simulation tile active.
Serialize ASnowTiledSurfaceManager::SnowSurfaceMaskSegments as a UPROPERTY, then rebuild the tile index from that serialized array at runtime.
Keep verbose tile/stamp logs behind debug flags:
KAMAZ_SNOW_TILE_DEPOSITKAMAZ_SNOW_TILE_PLOW- per-tile create/load/unload/save logs
Current Parameters
For /Game/kamaz5360/Maps/Tverskaya:
TileWorldSizeCm = 1000ActiveTileRadius = 3MaxLoadedTiles = 81SnowSurfaceVertexSpacingCm = 20bUseTiledBackgroundSurface = trueTiledBackgroundVertexSpacingCm = 500bKeepUnloadedDirtyTileVisuals = trueFarSnowTileVisualQuads = 10MaxFarSnowTileVisuals = 800
Expected Logs
KAMAZ_OSM_BUILD file=C:/git/kamaz5360/Import/OSM/tverskaya.osm ...
KAMAZ_SNOW_SURFACE_MASK segments=50099 restricted=1
KAMAZ_OSM_SNOW_MASK applied segments=50099
KAMAZ_SNOW_SURFACE_MASK_INDEX segments=50099 indexedTiles=87532
KAMAZ_SNOW_TILES start mode=ProceduralTileMeshes ...
KAMAZ_SNOW_TILE_BACKGROUND ...
Rule Of Thumb
Do not solve far visibility by keeping every distant tile active. Keep only nearby simulation tiles active, and use far visual LODs for distant saved/dirty state.