interface IRaycastBuffer (Niantic.ARDK.AR.Scanning.IRaycastBuffer)
Overview
Contains per-pixel color, normal, position, and confidence data. These are generated by raycasting a live reconstruction of the scanned scene from the current camera position. More…
interface IRaycastBuffer: IDisposable { // methods bool CreateOrUpdateColorTexture( ref Texture2D texture, FilterMode filterMode = FilterMode.Bilinear ); bool CreateOrUpdateNormalTexture( ref Texture2D texture, FilterMode filterMode = FilterMode.Bilinear ); bool CreateOrUpdatePositionTexture( ref Texture2D texture, FilterMode filterMode = FilterMode.Bilinear ); };
Detailed Documentation
Contains per-pixel color, normal, position, and confidence data. These are generated by raycasting a live reconstruction of the scanned scene from the current camera position.
This interface provides access to three Texture2D objects: one containing color, one containing normals, and one containing the position and confidence.
The textures are rendered in the same orientation as the camera image and will not necessarily match the screen orientation or the aspect ratio of the view in which the visualization is to be displayed.
Please see RaycastScanVisualizer for an example of IRaycastBuffer usage.
Methods
bool CreateOrUpdateColorTexture( ref Texture2D texture, FilterMode filterMode = FilterMode.Bilinear )
Populates a texture containing RGBA pixel colors.
Parameters:
texture |
Reference to a texture to be populated with the RGBA values. The texture will be created or resized if needed. If this parameter is null, a new texture will be allocated. For best performance, the Texture2D should be cached and reused across calls. The texture format will be set to TextureFormat.RGBA32. |
filterMode |
the FilterMode to use for the texture |
Returns:
true if the texture was successfully populated, false if not
bool CreateOrUpdateNormalTexture( ref Texture2D texture, FilterMode filterMode = FilterMode.Bilinear )
Populates a texture containing world-space unit normal vectors at each pixel.
The normals are packed into an RGBA32 texture with the X value in the red channel, Y in the green channel, and Z in the blue channel. The alpha channel is set to 1 if there is a valid normal in the pixel and 0 if not. Since each channel in an RGBA32 texture represents values between 0 and 1, the unit vectors are shifted and scaled. To recover the original unit normal, subtract 0.5 from each component, then multiply by 2.
Parameters:
texture |
Reference to a texture to be populated with the normals. The texture will be created or resized if needed. If this parameter is null, a new texture will be allocated. For best performance, the Texture2D should be cached and reused across calls. The texture format will be set to TextureFormat.RGBA32. |
filterMode |
the FilterMode to use for the texture |
Returns:
true if the texture was successfully populated, false if not
bool CreateOrUpdatePositionTexture( ref Texture2D texture, FilterMode filterMode = FilterMode.Bilinear )
Populates a texture containing a world-space position (XYZ) and confidence value at each pixel.
The values are packed into an RGBAHalf texture with the X value in the red channel, Y in the green channel, Z in the blue channel, and confidence in the alpha channel. Confidence is a value between 0 and 1 representing how confident we are that this pixel accurately represents the surface of the object being scanned. It will increase over time as additional samples are collected until it reaches 1.
Parameters:
texture |
Reference to a texture to be populated with the position and confidence data. The texture will be created or resized if needed. If this parameter is null, a new texture will be allocated. For best performance, the Texture2D should be cached and reused across calls. The texture format will be set to TextureFormat.RGBAHalf. |
filterMode |
the FilterMode to use for the texture |
Returns:
true if the texture was successfully populated, false if not