Skip to content

Rendering and lighting

Voxel data is converted into Godot mesh resources by the voxel meshing code under src/Voxel/. Neighbor visibility and block render properties determine which faces are emitted. Sections keep mesh work bounded and support spatial culling. A block’s render shape and its collision/selection behavior should remain conceptually separate even where current code shares geometry.

The atlas and lookup conventions are centralized in TextureAtlas and the block registration/data layer. Blocks own per-face texture selection. Search assets/ and the registry before adding anything; preserve .import sidecars and pixel filtering when assets are added.

Light values are stored with chunk section data and exposed through level read APIs. Lighting has separate sky and block-light responsibilities in the design; keep propagation and storage ownership clear. Lighting changes can invalidate meshes because light values are part of the rendered vertex data.

To investigate a visual defect, follow the block data → face visibility/texture lookup → generated vertex attributes → mesh/material/shader → scene display path. Check the section bounds and rebuild trigger before changing shader code. Shaders live under shaders/ and should be reused when they already express the effect.