Raw mesh

Demonstrates logging of raw 3D mesh data (so-called "triangle soups") with simple material properties and their transform hierarchy.

Used Rerun types used-rerun-types

Transform3D, Mesh3D

Background background

Raw 3D mesh data refers to the basic geometric representation of a three-dimensional object, typically composed of interconnected triangles. These triangles collectively form the surface of the object, defining its shape and structure in a digital environment. Rerun was employed to visualize and manage this raw mesh data, along with its associated simple material properties and transform hierarchy.

Logging and visualizing with Rerun logging-and-visualizing-with-rerun

The visualizations in this example were created with the following Rerun code:

3D mesh data 3d-mesh-data

The raw 3D mesh data are logged as Mesh3D objects, and includes details about vertex positions, colors, normals, texture coordinates, material properties, and face indices for an accurate reconstruction and visualization.

rr.log(
    path,
    rr.Mesh3D(
        vertex_positions=mesh.vertices,
        vertex_colors=vertex_colors,
        vertex_normals=mesh.vertex_normals,
        vertex_texcoords=vertex_texcoords,
        albedo_texture=albedo_texture,
        triangle_indices=mesh.faces,
        albedo_factor=albedo_factor,
    ),
)

Through Rerun's Transform3D archetype, essential details are captured to ensure precise positioning and orientation of meshes within the 3D scene.

rr.log(
    path,
    rr.Transform3D(
        translation=trimesh.transformations.translation_from_matrix(world_from_mesh),
        mat3x3=world_from_mesh[0:3, 0:3],
    ),
)

Run the code run-the-code

To run this example, make sure you have the Rerun repository checked out and the latest SDK installed:

pip install --upgrade rerun-sdk  # install the latest Rerun SDK
git clone git@github.com:rerun-io/rerun.git  # Clone the repository
cd rerun
git checkout latest  # Check out the commit matching the latest SDK release

Install the necessary libraries specified in the requirements file:

pip install -e examples/python/raw_mesh

To experiment with the provided example, simply execute the main Python script:

python -m raw_mesh # run the example

You can specify scene:

python -m raw_mesh --scene {lantern,avocado,buggy,brain_stem}

If you wish to customize it, explore additional features, or save it use the CLI with the --help option for guidance:

python -m raw_mesh --help