mesh-manager.md 4.2 KB
uid: arfoundation-mesh-manager

AR mesh manager

Some platforms provide a meshing feature that generates a mesh based on scanned real-world geometry. The mesh manager enables and configures this functionality on supported platforms.

Requirements

See documentation for your platform-specific package to confirm whether meshing is supported.

Additionally, not all devices provide support for all the features in the mesh manager. Some properties in the mesh manager are ignored on certain platforms. The platform-specific package documentation details which meshing features are available for each platform.

Using meshing in a scene

To use meshing with AR Foundation, you need to add the ARMeshManager component to your scene.

ARFoundation ARMeshManager component

Mesh Prefab

You need to set the meshPrefab to a Prefab that is instantiated for each scanned mesh. The meshPrefab must contain at least a MeshFilter component.

If you want to render the scanned meshes, you need to add a MeshRenderer component and a Material component to the meshPrefab's GameObject.

If you want to have virtual content that interacts physically with the real-world scanned meshes, you will need to add MeshCollider component to the meshPrefab's GameObject.

This image demonstrates a mesh Prefab configured with the required MeshFilter component, an optional MeshCollider component to allow for physics interactions, and optional MeshRenderer and Material components to render the mesh.

Mesh prefab example

Density

The density property, in the range 0 to 1, specifies the amount of tessellation to perform on the generated mesh. A value of 0 results in the least amount tessellation, whereas a value of 1 produces the most tessellation.

Not all platforms support this feature.

Normals

When the device is constructing the mesh geometry, it might calculate the vertex normals for the mesh. If you don't need the mesh vertex normals, disable normals to save on memory and CPU time.

Not all platforms support this feature.

Tangents

When the device is constructing the mesh geometry, it might calculate the vertex tangents for the mesh. If you don't need the mesh vertex tangents, disable tangents to save on memory and CPU time.

Not all platforms support this feature.

Texture coordinates

When the device is constructing the mesh geometry, it might calculate the vertex texture coordinates for the mesh. If you don't need the mesh vertex texture coordinates, disable textureCoordinates to save on memory and CPU time.

Not all platforms support this feature.

Colors

When the device is constructing the mesh geometry, it might calculate the vertex colors for the mesh. If you don't need the mesh vertex colors, disable colors to save on memory and CPU time.

Not all platforms support this feature.

Concurrent Queue Size

To avoid blocking the main thread, the tasks of converting the device mesh into a Unity mesh and creating the physics collision mesh (if the meshPrefab's GameObject contains a MeshCollider component) are moved into a job queue processed on a background thread. concurrentQueueSize specifies the number of meshes to be processed concurrently.