sky_visibility.computeShader
- README.md977 B
- bindings.yaml598 B
- shader.wgsl8.4 KB
This package holds more than this page lists. See all of its files in its world.
README.md
sky_visibility
One thread per cell of the chunk a dispatch covers. A cell casts 64 rays spread over the sphere (a Fibonacci spiral, the same for every cell) through the scene BVH; a ray that leaves every surface behind sees the sky. Per axis direction it writes the cosine-weighted share of the hemisphere around that axis whose rays saw the sky, and how far its ray along that axis reaches before a surface stops it, as a share of four cells; and per octant, how far its ray along that octant's diagonal reaches.
The cell lands as two vec4s in sv_cells, three bytes per lane packed as an
integer an f32 holds exactly, in the layout zero::environment_types states
for the environment's sky-visibility cells.
Bindings (see bindings.yaml): sv_cells (read_write), sv_grid (the grid's
resolution, origin, cell size and the BVH's counts), bvh_nodes, triangles.
The params the engine appends carry the chunk: itemBase, itemCount and
the dispatch grid's width.