Class HiZPyramid
Semantics: each tile stores the MINIMUM w (= 1/z, i.e. the FARTHEST written depth) over its pixels. A block whose nearest possible point (max w over its AABB corners) is farther than a tile's farthest written depth is behind something at every written pixel of that tile — and tiles with any unwritten (sky) pixel hold -infinity and never occlude. That makes the test conservative: it may keep a hidden block, it never culls a visible one — under a static camera. (The first version max-pooled, storing the NEAREST depth per tile; that culled houses visible BETWEEN nearer tree trunks — per-pixel gaps inside a tile are invisible to a max.) Camera motion reuses the stale pyramid, which can cull a newly-visible block wrongly; the block's pixels then contain far background depth, so the next frame's pyramid no longer occludes it — wrong culls self-heal in one frame (sanctioned design concession), and the query margin absorbs small-motion parallax.
Empty tiles (never depth-written) store -infinity and never occlude, so the first frame after startup (or after any pass that leaves the pyramid unbuilt) culls nothing.
Knobs: -Daukio.hiz=false disables culling (build still
happens — it is cheap — so flipping the flag needs no warm-up);
-Daukio.hiz.margin=0.02 sets the relative w-space safety
margin against parallax between frames.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AtomicLongBlocks culled as fully occluded (telemetry).final AtomicLongBlocks occlusion-tested this process (telemetry). -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
blocksTested
Blocks occlusion-tested this process (telemetry). -
blocksCulled
Blocks culled as fully occluded (telemetry).
-
-
Constructor Details
-
HiZPyramid
public HiZPyramid()
-
-
Method Details
-
buildFrom
public void buildFrom(float[] depth, int width, int height) Rebuilds the pyramid from a freshly painted depth buffer. -
occluded
public boolean occluded(double x1, double y1, double x2, double y2, double nearestW) Conservative whole-block occlusion test.- Parameters:
x1- ..y2 screen-space AABB of the block (will be clamped to the buffer; a fully off-screen box returns false)nearestW- the block's nearest possible depth = MAX 1/z over its corners- Returns:
- true when the block is certainly hidden behind last frame's occluders (within the parallax margin)
-