simvx.graphics.renderer.hiz_pass¶
Hi-Z depth pyramid build pass (occlusion-culling phase O2).
Builds a hierarchical depth pyramid from the HDR target’s D32 depth buffer: mip0 is a 1:1 copy of the scene depth, and each successive mip is a conservative MIN reduction (farthest occluder: depth is reverse-Z, so the far plane is 0) over the previous mip’s 2x2 footprint. The pyramid is consumed later (O3) by a compute occlusion cull; this phase only builds and validates it.
The pass is fully gated by Renderer._occlusion_culling_enabled: it is
lazily created on the first frame the toggle is on (mirroring VelocityPass),
so with occlusion off nothing here is allocated or dispatched.
Resource/descriptor approach mirrors :class:SSAOPass: a compute pass that
samples the samplable D32 depth target in DEPTH_STENCIL_READ_ONLY_OPTIMAL.
Module Contents¶
Classes¶
Builds a Hi-Z (hierarchical farthest-depth) pyramid via per-mip compute dispatches. |
Functions¶
Number of mip levels in the Hi-Z pyramid for the given base extent. |
|
Per-mip |
Data¶
API¶
- simvx.graphics.renderer.hiz_pass.__all__¶
[‘HiZPass’, ‘hiz_mip_count’, ‘hiz_mip_sizes’]
- simvx.graphics.renderer.hiz_pass.log¶
‘getLogger(…)’
- simvx.graphics.renderer.hiz_pass.hiz_mip_count(width: int, height: int) int¶
Number of mip levels in the Hi-Z pyramid for the given base extent.
floor(log2(max(w, h))) + 1so the top mip is 1x1.
- simvx.graphics.renderer.hiz_pass.hiz_mip_sizes(width: int, height: int) list[tuple[int, int]]¶
Per-mip
(w, h)dimensions, each(max(1, w>>i), max(1, h>>i)).
- class simvx.graphics.renderer.hiz_pass.HiZPass(engine: Any)¶
Builds a Hi-Z (hierarchical farthest-depth) pyramid via per-mip compute dispatches.
Initialization
- property mip_count: int¶
- property image: Any¶
The Hi-Z R32F mip-chain image (for O3 readers / test readback).
- property sampled_view: Any¶
Full-mip-chain sampled view (for the O3 occlusion cull’s textureLod).
- property sampler: Any¶
The NEAREST/CLAMP sampler shared by the build and the O3 cull.
- property base_extent: tuple[int, int]¶
Base (mip0) extent
(width, height)of the pyramid.
- setup(width: int, height: int, depth_view: Any, depth_image: Any, shader: str = 'hiz_build.comp') None¶
Allocate the pyramid image, per-mip views, sampler, descriptors and pipeline.
shaderselects the reduction compute shader; the default farthest-occluder pyramid serves occlusion culling,ssr_hiz.comp(nearest surface) serves the SSR trace.
- render(cmd: Any) None¶
Build the full pyramid: dispatch the reduction once per mip.
Call after the HDR pass has produced depth (depth in DEPTH_STENCIL_READ_ONLY_OPTIMAL). A pure depth reduction: no camera matrices.
- resize(width: int, height: int, depth_view: Any, depth_image: Any) None¶
Recreate the pyramid for a new extent and re-write descriptors.
- cleanup() None¶