interface IDepthBufferProcessor (Niantic.ARDK.AR.Awareness.Depth.IDepthBufferProcessor)
Overview
An interface that extracts information from a raw depth buffer for game code. More…
interface IDepthBufferProcessor: Niantic.ARDK.AR.Awareness.IAwarenessBufferProcessor { // properties IDepthBuffer AwarenessBuffer; float MaxDepth; float MinDepth; // methods void CopyToAlignedTextureARGB32( ref Texture2D texture, ScreenOrientation orientation ); void CopyToAlignedTextureRFloat( ref Texture2D texture, ScreenOrientation orientation ); float GetDepth(int viewportX, int viewportY); float GetDistance(int viewportX, int viewportY); Vector3 GetSurfaceNormal(int viewportX, int viewportY); Vector3 GetWorldPosition(int viewportX, int viewportY); }; // direct descendants class DepthBufferProcessor;
Inherited Members
public: // properties InterpolationMode InterpolationMode; float InterpolationPreference; Matrix4x4 SamplerTransform;
Detailed Documentation
An interface that extracts information from a raw depth buffer for game code.
Note
Requires that the ARSession is run with IARWorldTrackingConfiguration.DepthFeatures set to DepthFeatures.Depth.
Properties
IDepthBuffer AwarenessBuffer
The CPU copy of the latest awareness buffer.
float MaxDepth
The farthest perpendicular depth value to be considered meaningful.
float MinDepth
The closest perpendicular depth value to be considered meaningful.
Methods
void CopyToAlignedTextureARGB32( ref Texture2D texture, ScreenOrientation orientation )
Pushes the current state of the depth buffer to the specified target texture. The resulting texture will contain a display aligned representation of normalized depth values.
Note
Only use this call if you absolutely need the texture to be display aligned. It is faster to create a texture from the awareness buffer itself.
Parameters:
texture |
The target texture (ARGB32). If this texture does not exist, it will be created. It is the responsibility of the caller to release this texture. |
orientation |
The target orientation of the texture. This determines the resolution of the container. This has to be either landscape or portrait. |
void CopyToAlignedTextureRFloat( ref Texture2D texture, ScreenOrientation orientation )
Pushes the current state of the depth buffer to the specified target texture. The resulting texture will contain a display aligned representation of the raw depth values.
Note
Only use this call if you absolutely need the texture to be display aligned. It is faster to create a texture from the awareness buffer itself.
Parameters:
texture |
The target texture (RFloat). If this texture does not exist, it will be created. It is the responsibility of the caller to release this texture. |
orientation |
The target orientation of the texture. This determines the resolution of the container. This has to be either landscape or portrait. |
float GetDepth(int viewportX, int viewportY)
Returns the eye depth of the specified pixel.
Parameters:
viewportX |
Horizontal coordinate in viewport space. |
viewportY |
Vertical coordinate in viewport space. |
Returns:
The perpendicular depth from the camera plane if exists or float.PositiveInfinity if the depth information is unavailable.
float GetDistance(int viewportX, int viewportY)
Returns the distance of the specified pixel from the camera origin.
Parameters:
viewportX |
Horizontal coordinate in viewport space. |
viewportY |
Vertical coordinate in viewport space. |
Returns:
The distance from the camera if exists or float.PositiveInfinity if the depth information is unavailable.
Vector3 GetSurfaceNormal(int viewportX, int viewportY)
Returns the surface normal of the specified pixel.
Parameters:
viewportX |
Horizontal coordinate in viewport space. |
viewportY |
Vertical coordinate in viewport space. |
Returns:
Normal if exists or Vector3.up if the depth information is unavailable.
Vector3 GetWorldPosition(int viewportX, int viewportY)
Returns the world position of the specified pixel.
Parameters:
viewportX |
Horizontal coordinate in viewport space. |
viewportY |
Vertical coordinate in viewport space. |
Returns:
World position if exists or Vector3.zero if the depth information is unavailable.