Skip to main content

Module material

Module material 

Source
Expand description

Shared material and rendering components for voxel chunks.

Provides two rendering paths for voxel chunks:

  1. Texture array path (opt-in) — when ChunkTextureArray is inserted as a resource before the plugin initialises, chunks are rendered with ChunkMaterial, a custom PBR material that samples a texture_2d_array. The embedded WGSL shader applies per-vertex AO and simple diffuse lighting.

  2. Fallback path (default) — when ChunkTextureArray is absent, chunks use a shared bevy::pbr::StandardMaterial with vertex colors. This path requires no texture assets and is compatible with all VoxelType palettes.

Structs§

ChunkMaterial
Custom chunk material that samples a GPU texture_2d_array.
ChunkMaterialConfig
Configuration for the fallback StandardMaterial chunk material.
ChunkMaterialHandle
Internal resource that tracks which material handle all chunk entities share.
ChunkRendered
Marker component indicating a chunk entity has been set up for rendering.
ChunkTextureArray
Optional resource that opts chunks into the texture-array rendering path.

Functions§

build_texture_array
Assembles N identically-sized Images into a single GPU texture_2d_array.
chunk_aabb
Creates an axis-aligned bounding box sized for a standard voxel chunk.
setup_chunk_material
Startup system that creates the shared chunk material.
upgrade_to_texture_material
Upgrades existing chunk entities from StandardMaterial to ChunkMaterial once ChunkTextureArray becomes available (i.e. after async texture loading).