Skip to main content

Meshing

The meshing feature uses depth and tracking data to generate a mesh representing the estimated geometry of the scanned real world.

By placing the standard ARMeshManager (opens in new window) in a scene, developers can access a live mesh that allows virtual objects to interact with the real world environment. For example, a virtual ball thrown into a meshed scene will realistically bounce off of the floor and walls.

What's new?

When Niantic Lighship SDK is enabled in XR Settings, Meshing is now provided through Unity's AR Foundation Meshing Subsystem (opens in new window). Enabling Lightship in XR Settings provides an advanced implementation of the ARFoundation subsystem, powered by Lightship’s proprietary meshing technology. ARDK provides mesh data through the ARMeshManager (opens in new window).

note

Meshing will work on both lidar and non-lidar devices. This feature will also work on both Android and iOS platforms.

Meshing Extensions

Lightship's meshing system exposes extra options to allow you to tweak meshing rules for distance, quality, and clean-up.

Once you add the Lightship Meshing Extension script to the Meshing object, you will have access to these settings:

Lightship Meshing Extension settings
  • Target Frame Rate: The number of times per second to run the mesh update routine.
  • AR Fusion Parameters:
    • Maximum Integration Distance: The far distance threshold (in meters) for integrating depth samples into the 3D scene. A new mesh will NOT be generated beyond this distance.
    • Voxel Size: The size (in meters) of individual voxel elements in the scene. Higher values will save memory but also reduce the precision of the surface.
    • Enable Distance Based Volumentric Cleanup: Enable this to save memory and smooth latency by cleaning up already processed elements in the volumetric representation (once they move outside the region where new meshes are generated).
  • AR Meshing Parameters:
    • Mesh Block Size: The size of the mesh blocks used for generating the mesh filter and mesh collider.
    • Mesh Culling Distance: The distance where mesh blocks will be removed from the scene. Set to 0 to disable culling.
    • Enable Mesh Decimation: Enable to save memory be removing excess triangles from the mesh.
tip

If you are using a lidar device you will need to uncheck Prefer Lidar if Available in the Lightship Settings (top menu > Lightship > Settings) so the device will use Lightship depth instead of lidar.

For example, you can configure your application to mesh much larger distances by increasing the Voxel Size, turning on Enable Distance Based Volumentric Cleanup, and increasing Maximum Integration Distance and Mesh Culling Distance between 20 and 40 meters:

  • Target Frame Rate: 20
  • AR Fusion Parameters:
    • Maximum Integration Distance: 40
    • Voxel Size: 0.05
    • Enable Distance Based Volumentric Cleanup: True
  • AR Meshing Parameters:
    • Mesh Block Size: 1.4
    • Mesh Culling Distance: 40
    • Enable Mesh Decimation: True
caution

These settings are only recommended for high-end devices.