API reference
API reference
Select your platform
No SDKs available
No versions available

EnvironmentDepthManager Class

Extends MonoBehaviour
Surfaces _EnvironmentDepthTexture and complementary information for reprojection and movement compensation to shaders globally.
Enabling this class will allow you to make depth textures available from the system asynchronously. For more information, see Depth API Overview.
Enabling depth textures:
[SerializeField] private EnvironmentDepthManager _environmentDepthManager;
private IEnumerator Example()
{
//Check if this feature is supported on your platform
if(!EnvironmentDepthManager.IsSupported)
    {
        Debug.Log("This feature is not supported");
        yield break;
    }
//enables the feature and makes depth textures available
//depth textures will be available from the system asynchronously
    _environmentDepthManager.enabled = true;
while(!_environmentDepthManager.IsDepthAvailable)
        yield returnnull;
    Debug.Log("Depth textures are now available);
}
Using Depth Manager features:
privatevoid ExampleOccl()
{
//sets occlusion mode to "SoftOcclusion" \– this is the default value
  _environmentDepthManager.OcclusionShadersMode = OcclusionShadersMode.SoftOcclusion;
//sets occlusion mode to "HardOcclusion"
 _environmentDepthManager.OcclusionShadersMode = OcclusionShadersMode.HardOcclusion;
//sets occlusion mode to "None" \– it's a good idea to disable environmentDepthManager to save resources in this case
 _environmentDepthManager.OcclusionShadersMode = OcclusionShadersMode.None;
//remove hands from the depth map
 _environmentDepthManager.RemoveHands = true;
//disables the feature. Frees up resources by not requesting depth textures from the system
 _environmentDepthManager.enabled = false;
}

Public Statics

The shader keyword for enabling hard occlusions.
The shader keyword for enabling soft occlusions.

Fields

This transform allows you to override the default tracking space.

Properties

A list of mesh filters to be used with the Depth Masking feature.
If this list is left empty, the feature is disabled.
static IDepthProvider provider[Get]
Returns true if the current platform supports Environment Depth.
Returns true if depth textures were made available from the system.
If OcclusionShadersMode is specified, this component will enable a global shader keyword after receiving the depth texture.

To enable per-object occlusion, use a provided occlusion shader or modify your custom shader to support HardOcclusionKeyword or SoftOcclusionKeyword.
If set to true, hands will be removed from the depth texture.
For more information, see Hands Removal.
When using the Depth Mask feature, the world position of the environment depth and the world position of the meshes used in the masking process are compared, and the closest value will be taken.
To avoid z-fighting, adjust this value to move the meshes closer or further.

Events

Action< RenderTexture > onDepthTextureUpdate
Did you find this page helpful?
Thumbs up icon
Thumbs down icon