simvx.graphics.renderer.depth_prepass

Scratch depth prepass for two-phase Hi-Z occlusion culling.

Renders set A (the predicted occluders: instances visible last frame) depth-only into a dedicated full-res D32 SAMPLABLE target, from the main camera’s POV. The mid-frame Hi-Z build then reduces THIS scratch depth into the pyramid that the phase-2 cull tests set-B candidates against. Because the occluders are drawn and the pyramid rebuilt within the same frame, a newly disoccluded object is admitted the frame it becomes visible (no 1-frame pop).

Depth-only by construction: the render pass has zero colour attachments (_create_depth_only_pass), and the pipeline reuses shadow.vert / shadow.frag (transform SSBO via gl_InstanceIndex == first_instance slot, single mat4 push constant) but pushes the CAMERA view-projection and applies NO depth bias.

Fully gated by Renderer._occlusion_culling_enabled: created lazily on the first occlusion-enabled frame (mirrors VelocityPass / HiZPass), so the default path allocates nothing.

Module Contents

Classes

DepthPrepass

Owns the scratch D32 depth target + depth-only pipelines for phase 1.

Data

API

simvx.graphics.renderer.depth_prepass.__all__

[‘DepthPrepass’]

simvx.graphics.renderer.depth_prepass.log

‘getLogger(…)’

class simvx.graphics.renderer.depth_prepass.DepthPrepass(engine: Any)

Owns the scratch D32 depth target + depth-only pipelines for phase 1.

Initialization

property depth_view: Any

Scratch depth view (DEPTH_STENCIL_READ_ONLY after the pass) for the Hi-Z build.

property depth_image: Any
property extent: tuple[int, int]

Scratch depth target dimensions (width, height).

Equals the engine extent for the main pass’s prepass (kept in sync on window resize) and the VIEW target size for a per-view occlusion bundle, so callers must size their viewport from this, not from the engine.

property pipeline: Any
property pipeline_double: Any
property pipeline_layout: Any
property render_pass: Any
setup(width: int, height: int, ssbo_layout: Any) None

Allocate the scratch depth target + depth-only pipelines.

Called lazily by the renderer only when occlusion is first enabled, so the off path never touches any of this.

render(cmd: Any, scene_renderer: Any, view_proj_T: numpy.ndarray) None

Begin the scratch depth pass and draw set A (depth-only) via the scene renderer.

view_proj_T is the column-major (already-transposed) camera view-projection mat4 pushed to shadow.vert. scene_renderer issues the A-only opaque + double-sided draws from the phase-1-seeded final batch.

push_view_proj(cmd: Any, view_proj_T: numpy.ndarray) None

Push the column-major camera VP mat4 to the depth-only vertex shader.

resize(width: int, height: int) None
cleanup() None