skyVisibility.package
This package holds more than this page lists. See all of its files in its world.
README.md
skyVisibility
The public surface: build, clear, refresh, claim, release,
maintain, settings and gridFor.
It gathers the scene's static geometry with Baking.gatherMeshInstances, puts
it in a BVH, sizes a grid over the BVH's root bounds (gridFor), and dispatches
sky_visibility over the cells through Baking.newGpuScheduler, so a build
spends a bounded number of rays per frame. environment.setSkyVisibility
copies the cells into the environment the renderer shades with, behind the
dispatches that wrote them.
A claim keeps the field current. maintain is the tick, called each frame by
whoever holds a claim (the scene's sky components): it never yields, and it
starts the rebuild as a system task of its own (task.spawnSystem) on the
background lane (FrameBudget.background) when the static geometry changed,
when no field has been built, and when the render device was rebuilt; the task
waits for the edits to settle, then builds. The task outlives the sky that
started it, so a build a scene unload interrupts still releases what it holds.
A layer loading or unloading is such a change, and the field stands until the
rebuild replaces it.
What counts as a change is measured against what the field was built from: the
mesh and world placement of every static surface, so editing a material or a
light rebuilds nothing.