Working with Surface Meshes

Polygonal surface meshes are a common 3D representation, with subtle differences in the treatment of attributes like normals and uvmaps across formats. Since v0.15.0, Kaolin has tried to simplify and standardize the process of working with polygonal surface meshes in PyTorch.

Importing and Managing Meshes in PyTorch

With v0.16.0, we have introduced a consistent import function kaolin.io.mesh.import_mesh that imports geometry, normals and materials using the same conventions for .obj, .gltf, .glb, and .USD file formats. This importer outputs a convenient kaolin.rep.SurfaceMesh class that simplifies working with both single and batched meshes and their many attributes, including normals, uvmaps, vertex and face features, all represented as PyTorch tensors.

See Working With Meshes Tutorial Notebook at examples/tutorial/working_with_meshes.ipynb also explained below:

Mesh Operations

Kaolin Library philosophy is not to rely on opaque storage containers as inputs to basic operations, but rather take plain PyTorch tensors as arguments. As the result most mesh operations do not take kaolin.rep.SurfaceMesh as input, but its tensor attributes. For mesh-related opartions see:

  • kaolin.ops.mesh - general operations on meshes

  • kaolin.metrics.mesh - operations related to metrics

  • kaolin.io - individual importers for .obj, .gltf, .glb, and .USD file formats, and also support for cached datasets like ShapeNet and others.

  • kaolin.render.mesh - low-level differentiable rendering operations on meshes

Rendering

With v0.16.0 we have also introduced an easy and consistent way to render PyTorch meshes imported from .obj, .gltf, .glb, and .USD using kaolin.render.easy_render.render_mesh method. See Mesh Easy Render Tutorial Notebook at examples/tutorial/easy_mesh_render.ipynb.

../_images/easy_render_urchin.jpg

For example, here we render different passes of an in-the-wild Sea Urchin Shell GLTF mesh by Drakery, purchased on Sketchfab.