greedy_mesh.computeShader
- README.md1.2 KB
- bindings.yaml473 B
- shader.wgsl10.7 KB
This package holds more than this page lists. See all of its files in its world.
README.md
greedy_mesh
Turns a voxel chunk into a mesh, merging coplanar faces of one colour into the largest rectangle that covers them so a solid wall costs two triangles instead of two per voxel. One invocation per slice; the vertex and index counts are claimed atomically, so the pass writes both buffers in a single dispatch.
Bindings
| name | kind | what it is |
|---|---|---|
params | buffer (read, u32) | chunk size, padding and the origin the mesh is built around |
solid_padded | buffer (read, u32) | the chunk's occupancy bitmask, one voxel of padding on every side so a face test at the edge reads a real neighbour |
colors | buffer (read, u32) | one packed colour per voxel |
vertex_buf | buffer (read_write, u32) | the vertices produced, in the engine's vertex layout |
index_buf | buffer (read_write, u32) | the indices produced |
counters | buffer (read_write, atomic u32) | how many vertices and indices have been claimed |
Params
| name | type | what it is |
|---|---|---|
vertStride | u32 | one vertex in u32 words, so the writes follow the engine's vertex layout |