[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 return null;
Debug.Log("Depth textures are now available);
}private void 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;
}CustomTrackingSpace
: Transform |
This transform allows you to override the default tracking space.
Signature
Transform CustomTrackingSpace |
HardOcclusionKeyword
: const string |
The shader keyword for enabling hard occlusions.
Signature
const string HardOcclusionKeyword |
SoftOcclusionKeyword
: const string |
The shader keyword for enabling soft occlusions.
Signature
const string SoftOcclusionKeyword |
IsDepthAvailable
: bool
[Get] |
Returns true if depth textures were made available from the system.
Signature
bool IsDepthAvailable |
IsSupported
: bool
[Get] |
Returns true if the current platform supports Environment Depth.
Signature
bool IsSupported |
MaskBias
: float
[Get][Set] |
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.
Signature
float MaskBias |
MaskMeshFilters
: List< MeshFilter >
[Get][Set] |
A list of mesh filters to be used with the Depth Masking feature.
If this list is left empty, the feature is disabled.
Signature
List<MeshFilter> MaskMeshFilters |
OcclusionShadersMode
: OcclusionShadersMode
[Get][Set] |
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.
Signature
OcclusionShadersMode OcclusionShadersMode |
RemoveHands
: bool
[Get][Set] |
If set to true, hands will be removed from the depth texture.
For more information, see Hands Removal.
Signature
bool RemoveHands |