Skip to main content

Mesh Downloading

With the Mesh Download API, you can download and create a mesh of any Public Location at runtime, allowing you to dynamically create mesh overlays in AR scenes. This feature makes it easier to test AR experiences by allowing you to check that your mesh lines up with the real world without having to leave the test environment. For example, you can download a stored mesh after localizing to see how far offset your localization is and figure out how it needs to change. Mesh downloading also allows developers to place content in scenes and explore environmental interactions without needing to stop testing and set up each mesh they want to try.

Basic Usage

By default, downloading a mesh generates a GameObject to contain it and places the mesh at the local origin. You can instead place a mesh using an ARLocation payload or a persistent anchor to line it up with a real-world location. Optional parameters in the API allow for changes to maximum download size, meshing type, collider generation, and other settings. For more information, see the Mesh Download API reference.

Using Materials to Change a Mesh

By supplying different materials in the Unity Editor to the manager that controls the mesh, you can modify the mesh's traits using code instead of in the editor. By default, the API exposes two different types of mesh: VERTEX_COLOR AND TEXTURED. Vertex-colored meshes are faster to download, but require a material that handles colored vertices to render properly. (We provide a shader and material that can do this. Look for VertexColor.shader and vertex_color.mat in Unity!) Textured meshes can be rendered with the standard Unity material (or any other that handles textures), but including texture information increases download size.

In particular, we recommend using this feature to create a transparent mesh for debugging so that you can see if it overlays properly in real time. To learn how to do this, see the Mesh Download How-To.

Known Issues

  • Not all mesh types are available at each location. Specifically, coverage meshes are not available at private locations. If the requested mesh type is not available, the API will return null for the mesh.
  • Some meshes can be quite large. If download size or runtime performance is a concern, consider setting a maximum download size.