simvx.graphics.renderer.volumetric_fog_pass

Volumetric fog pass: single-scatter ray-marched fog (desktop Vulkan).

Full-screen HDR pass ported from the web volumetric_fog.wgsl shader. Reads the HDR colour + depth produced by the forward pass, ray-marches the WorldEnvironment-driven global fog (plus an exponential height gradient and any FogVolume3D instances collected from the scene tree), and writes the composited result to an alternate HDR target. The renderer then re-points the tonemap pass’s HDR input at that output: the same swap the custom post-process pass uses.

GPU-driven: the FogVolume3D set is packed into a single SSBO once per frame in numpy (build_volume_ssbo), never iterated in a per-object Python draw loop.

Module Contents

Classes

VolumetricFogPass

Ray-marched single-scatter volumetric fog over the HDR target.

Functions

build_volume_ssbo

Pack FogVolume3D nodes into a flat std430 byte array.

Data

API

simvx.graphics.renderer.volumetric_fog_pass.__all__

[‘VolumetricFogPass’, ‘MAX_FOG_VOLUMES’, ‘FOG_VOLUME_STRIDE’, ‘build_volume_ssbo’]

simvx.graphics.renderer.volumetric_fog_pass.log

‘getLogger(…)’

simvx.graphics.renderer.volumetric_fog_pass.FOG_VOLUME_STRIDE

112

simvx.graphics.renderer.volumetric_fog_pass.MAX_FOG_VOLUMES

64

simvx.graphics.renderer.volumetric_fog_pass.STEP_COUNT

32

simvx.graphics.renderer.volumetric_fog_pass.build_volume_ssbo(volumes: list[Any]) tuple[numpy.ndarray, int][source]

Pack FogVolume3D nodes into a flat std430 byte array.

Returns (bytes_array, count) where count is clamped to MAX_FOG_VOLUMES. Each record is::

mat4 inv_transform   (world → unit-local, column-major for GLSL)
vec4 albedo          (rgb, a unused)
vec4 params          (density, shape, edge_falloff, height_falloff)
vec4 extra           (priority, 0, 0, 0)

inv_transform folds the node’s world transform with a per-axis scale of size * 0.5 so the shape test in the shader is against a unit box / unit sphere / unit cylinder regardless of the volume’s placement.

class simvx.graphics.renderer.volumetric_fog_pass.VolumetricFogPass(engine: Any)[source]

Ray-marched single-scatter volumetric fog over the HDR target.

Initialization

property output_view: Any[source]

Colour view of the fog-composited HDR result (tonemap input).

setup(width: int, height: int, hdr_view: Any, depth_view: Any, colour_format: int) None[source]

Allocate the alt HDR target, buffers, descriptors and pipeline.

update_hdr_input(hdr_view: Any, depth_view: Any) None[source]

Re-point binding 0/1 at a new HDR colour + depth (after resize).

set_frame_data(view: numpy.ndarray, proj: numpy.ndarray, sun_dir: numpy.ndarray | None, sun_colour: numpy.ndarray | None, sun_intensity: float, volumes: list[Any]) None[source]

Stash camera / sun / volume data for the next render call.

render(cmd: Any) None[source]

Composite volumetric fog into the alt HDR target. No-op when off.

resize(width: int, height: int, hdr_view: Any, depth_view: Any) None[source]
cleanup() None[source]