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

volume_draw

The march of a volume standing in the scene, run as a render-feature pass for every view the frame draws. Each ray leaves the drawn camera (@frame.camera), is clipped against the volume's box and ends at the scene's depth (@scene.depth), so opaque geometry in front of the volume hides it and geometry inside it cuts the march where it stands. The march itself is the shared volume_march module's, the one volume_raymarch runs too.

A volume that scatters (scattering above 0) is lit by the light the surfaces of the view are shaded by: the scene's sun and ambient term (@frame.light, read through @builtin::shaderModules.frame_light) and the point, spot and rect lights reaching each sample (@scene.lights, through @builtin::shaderModules.scene_lights), up to the number of local lights the draw states. Each light is dimmed by the volume between it and the sample, in shadowSteps samples toward it (half as many toward a local light), so the far side of thick smoke stands in its own shadow; light scattered more than once greys that shadow rather than leaving it black. The sun is dimmed as well by the cloud layer's shadow at each sample (cloud_shadow, bound from @builtin::systems.volumetrics.cloudShadow), so smoke under a cloud loses the sun the ground under it loses. With every light dark a volume that neither emits nor burns renders black.

Each sample's light becomes the colour it adds through the light response it includes (medium_physical, or the module the draw names in lightResponse, which a program of the draw's stands in its place), handed the light's parts: the sun with nothing between, the share of it the volume lets through, the ambient term and the local lights.

Bindings (see bindings.yaml): volume and occupancy (texture3d), volume_smp (sampler), out_tex (storage2d rgba16f, sized to the drawn view), U (one VolumeUniforms), frame_cam (@frame.camera), scene_depth (@scene.depth), scene_light (@frame.light), lights (@scene.lights), and cloud_shadow_map (texture2d), cloud_shadow_smp (sampler) and cloud_shadow (buffer), what cloudShadow.bindings() names.

The volume module enqueues it, with the composite that lays its output over the frame, for every draw Volume:draw stands up.