Depth Blending

Note

This feature is an experimental feature and is subject to change. Experimental features should not be used in production products and are unsupported. We are providing these experimental features as a preview of what might be coming in future releases. If you have feedback on an experimental feature post your feedback in the Lightship Developer Community

Depth blending is an experimental feature that improves ARDK depth-based occlusions. Normally, if you are using depth-based occlusions, you can either use depth-buffer occlusions or screen space mesh-based occlusions. Depth-buffer occlusions work well for dynamic moving objects, but the occlusion results can be unstable and flicker. Screen space mesh-based occlusions are more stable, but can take time to adjust to dynamic objects. Depth blending uses both depth-buffer and mesh-based occlusions to produce stable occlusions that work well for both dynamic and static objects.

Note

Meshing must be enabled in your AR Session if you want to use depth blending. See Meshing - Setting up the AR Session for how to enable meshing. Additionally, make sure your project has an ARDK_FusedDepth layer, adding the layer if necessary. For the prefab you’ve set as the Mesh Prefab in your ARMeshManager, make sure the prefab is using the ARDK_FusedDepth layer.

Enable depth blending by setting ARDepthManager.StabilizeOcclusions to true.

Set your ARDepthManager.OcclusionTechnique (Occlusion Mode in the Unity inspector) to Depth Buffer, as described in Depth-based Occlusions. ARDK will now use depth blending to do occlusions.

Enabling depth blending incurs a small performance hit, so you may want to reduce your depth manager’s KeyFrameFrequency to compensate for this.

There’s currently a known issue where the depth stream used by depth blending can sometimes be uninitialized for the first few frames, which results in errors. This issue will be fixed in an upcoming release.

Additional Examples

See the OcclusionStabilizationExample scene in the ContextAwareness/Meshing folder of ARDK-examples for an example of using depth blending. Make sure the MeshDepthChunk prefab is set to the ARDK_FusedDepth layer (adding the layer if needed).