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¶
Ray-marched single-scatter volumetric fog over the HDR target. |
Functions¶
Pack |
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
FogVolume3Dnodes into a flat std430 byte array.Returns
(bytes_array, count)wherecountis clamped toMAX_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_transformfolds the node’s world transform with a per-axis scale ofsize * 0.5so 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
- 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).