Log inGet started
Package

volumetrics.package

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

volumetrics

Volumetric (3D-texture) rendering, end to end, in one package. Built entirely on the engine's generic compute.* GPU primitives — no Rust changes are needed to author new volumetric content.

Layout

AssetIdentityRole
Volume.component@builtin::systems.volumetrics.VolumeAttach a 3D voxel texture to an entity; stands it in the scene through the entity's transform AABB, hidden by what stands in front of it.
VolumetricSky.component@builtin::systems.volumetrics.VolumetricSkyClouds in the sky: one per scene, the procedural cloud layer lit by the scene's sun (through the physical atmosphere's air and sky when a PhysicalAtmosphere stands in the scene), drawn by volumetricSky.renderFeature with no composite authored.
VolumetricLighting.component@builtin::systems.volumetrics.VolumetricLightingLight shafts, god rays and glowing air: light scattering between the camera and the scene, drawn by lightScattering.renderFeature.
ParticipatingMedium.component@builtin::systems.volumetrics.ParticipatingMediumMark an entity as fog/smoke/dust the camera sees through and that shades the sun on what is under it.
Smoke.component@builtin::systems.volumetrics.SmokeSmoke rising from the entity's position: a chimney's column, steam, a smoulder, a black column over a big fire, smoke signals; lit by the scene with a shadow of its own.
Fire.component@builtin::systems.volumetrics.FireFire with its smoke at the entity's position: a campfire, a torch, a bonfire, a building on fire, an explosion's fireball; flames glow along a blackbody ramp and a flickering point light halfway up them lights the surroundings.
plume.module@builtin::systems.volumetrics.plumeThe smoke and fire plumes Smoke and Fire hold, from a script: styles, sizes, quality levels; fills a volume each drawn frame and stands it with Volume:draw.
mediaTransmittance.module@builtin::systems.volumetrics.mediaTransmittanceThe registry of media and the settings every media pass reads.
mediaShadow.renderFeature@builtin::systems.volumetrics.mediaShadowWrites the sun the media take to @scene.sunOcclusion and marches each view ray through the media.
volume.module@builtin::systems.volumetrics.volumeBuilders (noise/sphere/box/wrap) + the .zvol header reader + occupancy + brick paging + the per-entity raymarch dispatch + the draws standing in the scene (Volume:draw).
volume.renderFeature@builtin::systems.volumetrics.volumeRuns every standing draw's march and composite for each view the frame draws, against its camera and depth.
VolumeSequence.component@builtin::systems.volumetrics.VolumeSequencePlay an open volume sequence through an entity's transform AABB.
volumeSequence.module@builtin::systems.volumetrics.volumeSequenceA run of .zvol frames streamed through a fixed ring of resident volumes.
volumeDemos.module@builtin::systems.volumetrics.volumeDemosShared pipeline for the showcase scenes (fill + emissive raymarch + composite).
volumetricSky.module@builtin::systems.volumetrics.volumetricSkyThe cloud layer: tiling noise, weather map, raymarch, TAA and composite orchestration.
volumetricSky.renderFeature@builtin::systems.volumetrics.volumetricSkyThe cloud layer's passes for every view the frame draws, brought up by VolumetricSky.
cloudShadow.module@builtin::systems.volumetrics.cloudShadowThe shadow the cloud layer casts on everything the sun lights under it: its map, the surfaces' share in @scene.sunOcclusion, and the bindings a pass marching the air reads it through.
volumetricLighting.module@builtin::systems.volumetrics.volumetricLightingThe light-scattering settings, set from code.
lightScattering.renderFeature@builtin::systems.volumetrics.lightScatteringThe light-scattering passes, brought up by VolumetricLighting.
shaders/*@builtin::systems.volumetrics.shaders.*Compute shaders volume_raymarch, volume_draw, plume_fill, volume_pages, volume_pack, cloud_noise, cloud_weather, cloud_raymarch, cloud_taa, cloud_layer_surfaces, cloud_shadow_map, cloud_shadow_apply; shaders volume_draw_composite, cloud_layer_composite, cloud_layer_blit, cloud_sky_composite; shader modules volume_march, cloud_light, cloud_surface, cloud_shell, cloud_density, cloud_shadow, cloud_shadow_space.
importers/vdb_to_zvol.importer(auto-discovered).vdb → dense .zvol via the openvdb WASM plugin (procedural fallback when the plugin isn't loaded).
presets/cumulus_default.preset@builtin::systems.volumetrics.presets.cumulus_defaultCanonical full VolumetricSky weather preset.

The guide systems/volumetrics/documentation/README (guides { path = ... }) names the component for each effect, clouds, fog, light shafts, a fog or smoke volume and the sky, with what each does and costs.

The scenes in showcase/volumetrics of the public Engine Showcase world show each effect running: showcase, sky, godrays, smoke_plume, nebula, sdf_solids and zvol_viewer, with their fill shaders (install one with the zeromind toolbox's installAsset).

Path convention — fully-qualified builtin identities

Every intra-package reference uses the asset's fully-qualified builtin identity, the same convention every other builtin package follows:

local Volume = require("@builtin::systems.volumetrics.volume")
local Sky    = require("@builtin::systems.volumetrics.volumetricSky")
local V      = require("@builtin::systems.volumetrics.volumeDemos")
-- shader identities, e.g. asset.resolve("@builtin::systems.volumetrics.shaders.volume_raymarch")

Qualified identities are caller-independent: they resolve identically from a module, a scene entrypoint, or a component. Caller-relative (.sibling) requires are deliberately avoided here because the component runtime caller identity is @builtin::components.<Name>, so a .sibling require from a component resolves against the wrong root. (An earlier revision of this package used a ~volumetrics package-root alias for relocatability; that alias is not resolvable on current main, so the package uses qualified identities throughout.)

Usage

-- Per-entity volume. The component resolves the name through `Volume.get`,
-- so a volume paged into a brick pool renders from the pool under the same
-- name:
local Volume = require("@builtin::systems.volumetrics.volume")
local cloud = Volume.noise({ name = "cloud", size = 64, scale = 4 })
cloud:buildSparse({ brickSize = 8 })
cloud:releaseDense()
entity(id).component.add("Volume", { volumeName = "cloud", density = 6.0 })

-- Procedural sky:
local sky = entity.spawn("sky")
sky.component.add("VolumetricSky", {})
preset.apply("cumulus_default", { entity = sky.id, component = "VolumetricSky" })

-- VDB import: drop a `.vdb` into the VFS; the importer writes a `.zvol`
-- alongside it. The Engine Showcase world's `zvol_viewer` scene draws one.

-- Animated run: one `.zvol` per frame, played through a bounded ring.
local Seq = require("@builtin::systems.volumetrics.volumeSequence")
Seq.open({ name = "plume", frames = framePaths, resident = 3, fps = 24 })
entity(id).component.add("VolumeSequence", { sequenceName = "plume", density = 6.0 })

Plugin dependency

The VDB importer delegates real OpenVDB parsing to the openvdb plugin in the builtin library, @builtin::plugins.openvdb. Without the plugin the importer falls back to a deterministic procedural torus so the pipeline stays functional.