Skip to main content

Module voxel

Module voxel 

Source
Expand description

Voxel effects built on one fast mesher: smoke that rises and swirls, and drifting clouds.

Both produce a single DynamicMesh (one draw call). Hidden faces between touching voxels are never emitted, so a large cloud costs only its visible surface.

Structs§

CloudVolume
Describes the density grid of a cloud layer; its key() goes into MeshRenderer.texture.
VoxelClouds
Volumetric clouds: a voxel density grid (generated from fractal noise) that the GPU ray-marches with sun scattering and self-shadowing. The entity draws only an inverted bounding box.
VoxelSmoke
Voxel smoke emitter and simulation parameters. Runtime density is not serialized.

Constants§

CLOUD_VOLUME_PREFIX
Prefix for procedural three-dimensional cloud density texture keys.

Functions§

mesh_grid
Meshes a voxel grid. density(x, y, z) > threshold means filled; uv.x carries the density. With shrink every voxel is scaled by its density (soft puffs, all faces emitted); otherwise full cubes are merged and faces between neighbours are culled.
mesh_grid_greedy
Merges coplanar exposed faces with equal density. Each cell is sampled once. A solid cuboid becomes six quads. Invalid parameters or >16M cells return an empty mesh.
update_clouds
Refreshes cloud proxy geometry and shader parameters; drift advances only while simulating.
update_smoke
Creates/rebuilds smoke meshes and optionally advances the density simulation by dt seconds.