Depth composition

For usage and limitations, see Gaussian splatting.

Requirement: Optional shared depth REQ_DEPTH_SHARED
status: implemented
is implemented by: SPEC_DEPTH_ATTACHMENT
is verified by: TEST_DEPTH_ORDER

Render passes and either Gaussian backend shall be composable in either order with an optional shared per-path depth attachment. Without an attachment, rendering shall retain its color-only behavior.

Requirement: Independent depth controls REQ_DEPTH_CONTROLS
status: implemented
is implemented by: SPEC_DEPTH_ATTACHMENT
is verified by: TEST_DEPTH_CONTROLS

Each rendering stage shall independently enable or disable depth testing and depth writing. Testing shall reject contributions behind the existing surface; writing shall update the depth for subsequent stages. Disabling writes shall leave existing depth unchanged.

Requirement: Selectable Gaussian surface estimate REQ_DEPTH_METHODS
status: implemented
is implemented by: SPEC_DEPTH_METHODS
is verified by: TEST_DEPTH_METHODS

Both Gaussian backends shall support accumulated-opacity and nearest-opaque-splat depth, with a configurable opacity threshold. The default shall be accumulated opacity on compute and nearest opaque splat on raster. Depth export shall be optional and independent of the shared attachment’s testing and writing controls.

Requirement: Depth lifetime and paths REQ_DEPTH_PATHS
status: implemented
is implemented by: SPEC_DEPTH_ATTACHMENT
is verified by: TEST_DEPTH_PATHS

Each execution path shall have independent depth storage. A shared attachment shall clear once per graph execution by default, with optional preservation between executions. Mismatched color/depth extents or path counts shall be rejected.

Specification: Native depth attachment and GPU transfers SPEC_DEPTH_ATTACHMENT

DepthAttachment owns D32_SFLOAT images left in DEPTH_STENCIL_ATTACHMENT_OPTIMAL. Render passes load and store them using the configured DepthState, comparing with LESS_OR_EQUAL when testing. Writing without testing uses ALWAYS. Built-in draw components use the render pass’s pipeline depth state. Color producers report their final layout so later writers can preserve the image while transitioning it.

Compute splatting reads GPU buffer snapshots; raster splatting uses native read-only depth testing. Gaussian surface updates use GPU-only transfers. The graph orders snapshots after the preceding color producer and attachment updates after the depth calculation. No per-frame CPU readback is used.

Specification: Gaussian depth selection SPEC_DEPTH_METHODS
status: implemented
implements: REQ_DEPTH_METHODS
is verified by: TEST_DEPTH_METHODS

AccumulatedOpacity selects the first depth where cumulative opacity reaches depthOpacityThreshold. NearestOpaqueSplat selects the nearest splat whose individual per-pixel opacity reaches that threshold. The default threshold is 0.5; valid thresholds are in (0, 1]. BackendDefault selects accumulated opacity on compute and nearest opaque splat on raster. outputDepth exports a float buffer with positive infinity where no Gaussian surface was selected. The shared attachment instead retains its previous value where no surface was selected, and clears to 1 by default.

Raster accumulated-opacity depth is computed by a depth-only compute pipeline; nearest-splat depth uses fragment atomics where supported, with a compute fallback otherwise. Each method is an approximation to a translucent surface, so different rendering orders need not give identical translucent blending.

Test: Raster and Gaussian rendering order TEST_DEPTH_ORDER
status: verified
gtest: DepthComposition.gaussianAndRasterPassesComposeInEitherOrder

Checks nearer and farther opaque geometry in both rendering orders, with both Gaussian backends and both depth methods.

Test: Independent test and write controls TEST_DEPTH_CONTROLS
status: verified
gtest: DepthComposition.gaussianDepthControlsAreIndependent, DepthComposition.nativeDepthControlsAreIndependent

Disables testing and writing separately and verifies the resulting occlusion.

Test: Clearing, reuse and separate paths TEST_DEPTH_PATHS
status: verified
gtest: DepthComposition.depthClearsBetweenFramesAndPathsStaySeparate, DepthComposition.preservesDepthWhenClearingIsDisabled, DepthComposition.rejectsMismatchedExtents, DepthComposition.rejectsMismatchedPathCounts

Reuses compiled graphs with moved Gaussians and two paths, verifies clearing and independent color results, verifies explicit depth preservation, and rejects mismatched attachment extents and path counts.

Test: Both methods on both backends TEST_DEPTH_METHODS
status: verified
gtest: GaussianSplatDepthTest.depthMethodsAreSelectableOnBothBackends

An overlapping translucent stack has an accumulated-opacity surface and no individually opaque-enough splat, with the same selected method on either backend.