Distance fade: sim-surround sculpts and terrain don't haze when flying high #158

Closed
opened 2026-09-29 04:52:42 +00:00 by sky_line · 0 comments
Owner

Flying high above a sim, big sculpts (sim surrounds) and terrain don't fade into the haze like the rest of the objects, so they stand out sharp against the faded scene.

Cause

clean_draw.frag skips atmosDistanceFade for fragments with VS flag bit14 ("encloses camera"). clean_draw.vert sets that bit when the instance's bounding sphere contains the camera. The exemption was made for weather domes / skyboxes the viewer sits inside: fading them by depth replaced a ~750 m dome with the sky.

The sphere test is far too coarse for large, flat objects:

  • Sim-surround sculpts are ~1024 x 1024 x 100 m (the #VKHuge# log line keeps reporting one, size 1451 m), so their sphere has a radius of ~700 m. Flying anywhere above the sim puts the camera "inside" it, and the whole object is drawn unfaded.
  • Terrain pieces / large ground meshes hit the same test while you're over them.

Fix direction

Make the exemption match its purpose (things around you, like domes and skyboxes) instead of "bounding sphere contains the camera":

  • Keep fading below-horizon fragments for every object, enclosing or not. Since #150 the fade target below the horizon is aerial-perspective haze, not sky, so the ground part of a surround or of terrain hazes like everything else without turning into sky. Only at/above-horizon fragments of enclosing objects stay unfaded (the dome case).
  • And/or tighten the enclosure test: camera inside the actual AABB (not the sphere), plus a thickness check so flat surrounds don't qualify when you're above them.
  • Check terrain goes through the same fade and haze path as objects (flags bit5 32u skips some haze branches in clean_draw.frag; confirm it gets atmosApply + atmosDistanceFade like other world faces).

Test: fly to a few hundred metres over a sim with a sculpted surround and look down and toward the horizon. Surround, terrain and objects should all fade together, and a weather dome / skybox you're inside must still render unfaded.

Related: #150 (below-horizon fade target).

Flying high above a sim, big sculpts (sim surrounds) and terrain don't fade into the haze like the rest of the objects, so they stand out sharp against the faded scene. ## Cause `clean_draw.frag` skips `atmosDistanceFade` for fragments with VS flag bit14 ("encloses camera"). `clean_draw.vert` sets that bit when the instance's **bounding sphere** contains the camera. The exemption was made for weather domes / skyboxes the viewer sits inside: fading them by depth replaced a ~750 m dome with the sky. The sphere test is far too coarse for large, flat objects: - Sim-surround sculpts are ~1024 x 1024 x 100 m (the `#VKHuge#` log line keeps reporting one, size 1451 m), so their sphere has a radius of ~700 m. Flying anywhere above the sim puts the camera "inside" it, and the whole object is drawn unfaded. - Terrain pieces / large ground meshes hit the same test while you're over them. ## Fix direction Make the exemption match its purpose (things around you, like domes and skyboxes) instead of "bounding sphere contains the camera": - **Keep fading below-horizon fragments for every object**, enclosing or not. Since #150 the fade target below the horizon is aerial-perspective haze, not sky, so the ground part of a surround or of terrain hazes like everything else without turning into sky. Only at/above-horizon fragments of enclosing objects stay unfaded (the dome case). - And/or tighten the enclosure test: camera inside the actual AABB (not the sphere), plus a thickness check so flat surrounds don't qualify when you're above them. - Check terrain goes through the same fade and haze path as objects (flags bit5 `32u` skips some haze branches in `clean_draw.frag`; confirm it gets `atmosApply` + `atmosDistanceFade` like other world faces). Test: fly to a few hundred metres over a sim with a sculpted surround and look down and toward the horizon. Surround, terrain and objects should all fade together, and a weather dome / skybox you're inside must still render unfaded. Related: #150 (below-horizon fade target).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#158
No description provided.