

Limitation | Reason | Suggested workaround |
Occlusions flicker near surfaces | This is caused by an issue often referred to as “Z-fighting”. In 3D graphics, this usually happens when two virtual objects are rendered at the same depth. Environment depth values are produced within the error margin, so in this case, z-fighting is apparent even when the depth is not precisely the same across frames. | Consult this documentation’s section on Environment Depth Bias. However, it is recommended to offset objects that you place on Scene Model surfaces along the surface normal. |
Occlusions aren’t matching the real-world and lag behind during fast motion | Real-time depth sensing has limitations that prevent pixel-perfect occlusions from being achieved at the same frame rate as app rendering. | Soft occlusion shaders reduce visibility issues, but apps must be designed considering this limitation. |
Note: Hard occlusions are deprecated as of Meta XR Plugin for Unreal Engine 5.5. TheEOculusXROcclusionsModeenum value has been renamed toHardOcclusions_Deprecated. Use soft occlusions for new projects.
UOculusXRFunctionLibrary for controlling environment depth occlusions:| Function | Type | Description |
|---|---|---|
StartEnvironmentDepth() | BlueprintCallable | Creates the environment depth texture swap chain and starts receiving depth textures each frame |
StopEnvironmentDepth() | BlueprintCallable | Destroys the swap chain and stops receiving depth textures |
IsEnvironmentDepthStarted() | BlueprintPure | Returns true if environment depth is currently active |
SetXROcclusionsMode(EOculusXROcclusionsMode) | BlueprintCallable | Sets the occlusion mode ( Disabled, SoftOcclusions) |
SetEnvironmentDepthHandRemoval(bool) | BlueprintCallable | Toggles hand removal from depth textures |
EOculusXROcclusionsMode enum has three values: Disabled (0), HardOcclusions_Deprecated (1), and SoftOcclusions (2).