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)[source]

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

Initialization

property depth_view: Any[source]

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

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

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[source]

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[source]

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

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