Tell the two passenger types apart, color them by a value and process a mesh

Work with mesh and tet volume items

A tri mesh item and a tet volume item are finished geometry in the scene. A bake makes them from an SDF branch, and an import makes a mesh from a file. This page tells how to tell the two types apart, how to color them by a value and how to process them.

Tell a mesh from a tet volume

From the outside, a tet volume looks like a tri mesh: you see the triangles of its boundary. The viewport gives each type its own tone, so you can tell them apart.

  • A tri mesh shows the primary color of the palette, turned by half a turn of hue.
  • A tet volume shows the primary color, turned by three quarters of a turn.
  • Both types draw the edges of their triangles, a little lighter than the surface.
  • The scene tree row shows the same tone as the viewport.

A tri mesh and a tet volume in their tones

If you give the item a material, the material colors the item instead of the tone. A hovered or selected item shows its outline only.

Color an item by a value

An item can show a scalar field of its asset through a colormap. To choose the field:

  1. Right-click the mesh row or the tet volume row.
  2. Choose Mesh ▸ Color by or Tet ▸ Color by.
  3. Choose a field, or none to show the tone again.

The menu lists the fields that the item's asset has. A tri mesh always has dihedral, the largest angle between two faces at each vertex. A tet volume always has quality, volume and depth. A result of a simulation that is stored in the file shows as one more field.

A tet volume colored by quality and a mesh colored by dihedral angle

The expanded row of a tet volume has the same choice, in its Coloring box. Undo restores the field that the item showed before.

Process a mesh

The Mesh ▸ submenu of a mesh row holds the operations that work on a finished mesh:

Entry What it does
Weld vertices Joins the vertices that are at the same position
Merge coplanar faces Joins the neighbor triangles that are in one plane
Decimate ▸ 50 % · 25 % · 10 % Keeps that part of the triangles and keeps the shape as near as it can
Subdivide Splits each triangle into four and smooths the surface
Fill holes Closes each hole of up to 100 boundary vertices
Remove degenerate triangles Removes the triangles that have no area
Flip faces Turns each triangle to face the other way

A mesh row's menu with the Export and Mesh submenus open

An operation changes the item. It does not add a new item.

  1. The operation runs as a job, and the row shows that it is busy. You can work in the scene while it runs.
  2. The job writes the result as a new file next to the old file.
  3. The item then uses the new file, and the viewport draws it.

Each operation is one undo step. Undo goes back to the old file, which stays on disk while an undo or a redo step can use it. When you save the scene, the app deletes the files of operations that no item and no undo step uses. It looks only in the scene's own bake folders, and it keeps a file that another scene in the same folder uses. If you delete the item, or undo an earlier operation on it, while the job runs, the scene ignores the result of the job.

The item records each operation that it got. If you regenerate a baked mesh, the bake runs again from its SDF branch with the settings of the first bake, and then each recorded operation runs again, in the same order.

The operations that need an SDF field, for example the surface projection of the export dialog, are not in this menu. A finished mesh has no field.

Work with a tet volume

The Tet ▸ submenu of a tet volume row holds:

Entry What it does
Remove degenerate tets Removes the tetrahedra that have no volume
Color by Chooses the field that colors the volume. See Color an item by a value
Quality summary Shows the lowest, mean and highest quality of the elements, and how many are under 0.1

A tet volume row's menu with the Bake and Tet submenus open

Remove degenerate tets is an operation, as the ones of the Mesh ▸ submenu: one job, one new file and one undo step. The cut plane stays in the expanded row of the tet volume.

A tet volume that you baked from an SDF item can also regenerate. Choose Bake ▸ Regenerate on its row. The bake runs again with the settings of the first bake, and then each recorded operation runs again.

The quality of a tetrahedron is its shortest edge divided by its longest edge. A regular tetrahedron has quality 1. A sliver, which has one very short edge, has a quality near 0. The solver gives a less accurate result in slivers, so a volume with many elements under 0.1 needs a finer bake.

Turn a tet volume into a tri mesh

To get a tri mesh of a tet volume's outside, right-click the tet volume row and choose Bake ▸ Tri mesh (boundary). A new mesh item appears next to the volume, with the same parent and the same transform.

  • The mesh has the exact positions of the volume's outer nodes. Nothing is welded, smoothed or simplified.
  • The mesh shades flat, as the volume does, so the two look the same. Where both show, the viewport draws a fine checker of the two tones.
  • A field of the volume, for example a simulation result, goes with each outer face to the mesh.
  • The mesh is written as a VTK file next to the scene, so its fields stay with it. Save the scene before you bake.

A tet volume and its boundary bake, apart and in one place

To make the mesh lighter, use the Mesh ▸ submenu on the new row, for example Decimate ▸ 50 %. Undo removes the mesh. Regenerate on the mesh runs the bake again from the volume, then each operation that the mesh got.

The cut plane of the volume does not cut the bake. The bake is the whole outside.

Export a mesh or a volume to a file

A mesh or a tet volume writes to a file as it is, with no meshing options:

  1. Right-click the row.
  2. Choose Export ▸ Tri mesh to file... or Export ▸ Tet volume to file....
  3. Choose the file in the save dialog.

A mesh writes to STL, OBJ, PLY or VTK. A tet volume writes to VTK only, because the other formats cannot hold tetrahedra.

To write the outside of a tet volume as a tri mesh, choose Export ▸ Tri mesh (boundary) to file... on the tet volume row. It writes the same surface as the boundary bake, to STL, OBJ, PLY or VTK, and adds nothing to the scene.

A tri mesh cannot become a tet volume yet. On a mesh row, Export ▸ Tet volume... and Bake ▸ Tet volume are disabled, and their tooltip tells why. See Bake and Export for the SDF branch side.

Script it

Each menu entry on this page has an OPAL task that runs the same code:

Task What it does
construct.bake with kind tri_boundary Bake ▸ Tri mesh (boundary)
construct.passenger.process One Mesh ▸ or Tet ▸ operation. It takes any step of the chain, for example qemDecimate(0.33)
construct.passenger.set_color Color by, with an optional colormap and range
construct.item.export_file with kind as_is or tri_boundary Export ▸ ... to file
construct.scene.get_item The counts, the fields, the recorded operations and the file of an item

This plan bakes a tet volume, bakes its boundary, decimates the mesh to half and exports it:

{
  "steps": [
    {"task": "construct.bake", "args": {"item": "Body", "kind": "tet", "cells": 64},
     "produces": {"tet": "itemId"}},
    {"task": "construct.bake", "args": {"item": "${tet}", "kind": "tri_boundary"},
     "produces": {"boundary": "itemId"}},
    {"task": "construct.passenger.process", "args": {"item": "${boundary}", "step": "qemDecimate(0.5)"}},
    {"task": "construct.item.export_file", "args": {"item": "${boundary}", "path": "body.ply"}}
  ]
}

Run it with construct opal plan.json scene.construct. Each step prints its time.

In this section
Topics
howto construct mesh tet passenger