# Tetrahedralization¶

This tutorial demonstrates multiple ways to create a tetrahedralized geometry in
*Houdini*.

## Converting Surface Geometry To Tetrahedrons¶

*Houdini* provides a node called *Tetrahedralize*, which allows the conversion
of a surface geometry into a tetrahedron geometry.
This node offers different levels of customization.

Note

Input geometry for *Tetrahedralize* nodes but be closed (only manifold
edges) and free of self-intersections.

Independently from the tool used to create tetrahedralized geometry, it is important to know which type of tetrahedralization is needed for the current object. There are two common use cases: First, achieve a tetrahedralization which consists of tetrahedrons of uniform sizes. This is used for geometry where all parts are subject to similar or equal deformation, e.g. a mattress. The second case arises when tetrahedralizing an object containing thin and thick regions. Imagine a bunny model: The ears are rather thin and subject to lots of deformations while the main body is quite round and thick. The body will most likely never be completely flattened and only the surface layer needs to undergo deformations. In order to reduce the number of tetrahedrons and increase the simulation speed, larger tetrahedrons can be applied in the core of the bunny geometry.

In either case: Try to avoid shard or splinter-like tetrahedrons.
Often, a geometry might seem to be perfectly tetrahedralized at first glance,
but this might only be true for the outside, while the inner tetrahedrons could
be splinter or shard-shaped.
In order to help detect such cases, use the
Cross Section Guide Geometry.
This tool can slide a cross section plane within the collision bounding box of
the tetra geometry, visualizing the containing geometry at the plane.
The screenshots below show a tetrahedralization containing
shard/splinter-shaped tetrahedrons on the left and a uniform tetrahedralization
on the right, visualized with a *Plane Offset* of 0.

The following explains different ways to achieve tetrahedralizations that are
well suited for simulations.
They are obtained with the *Tetrahedralize* node and focus on examples of
geometry that contain tetrahedrons of uniform volumetric size.
Each screenshot shows the nodal graph in Houdini, then the tetrahedron geometry
visualized with the Cross Section Guide
Geometry, where the *Plane Offset* parameter is set to 0, while the right image
shows the Cross Section geometry with a
*Plane Offset* of 1.

### Default Tetrahedralization¶

The simplest tetrahedralization possible is achieved by applying a
*Tetrahedralize* node with default parameters.
Clusters of that geometry are used in Tetra Setup to create a
uniformly tetrahedralized mattress.

### Adapt The Volume Size¶

If a more refined tessellation is required, enable *Quality* and then choose
*Uniform* as *Max Volume Constraint* in the *Tetrahedralize* node.
Adapt the *Max Volume* parameter until the desired granularity is achieved.

The downside of this simple approach is that there is a diagonal line, similar to the default tetrahedralization. Such a line imposes a behavioral pattern and the resulting simulation shows non-uniform behavior.

### Remesh The Surface¶

In order to remove such a pattern, add a *Remesh* node between the *Box* and the
*Tetrahedralize* node.
It is also necessary to add a *Group* node containing all 12 edges of the box
and pass it along as *Hard Edges Group*, as otherwise, the box would be smoothed
to a rounder shape.

Adding the *Group* and *Remesh* nodes results in a tetrahedralization which is
perfectly suited for simulations:

Note

If surface preservation is required, enable *Suppress Boundary
Modifications* in the *Tetrahedralize* node.

### Perfect Tetrahedrons¶

Using the same setup as just above, it is possible to constrain the
*Tetrahedralize* node in a way that results in a tetrahedralization with equally
sized tetrahedrons, which also have equally sized triangles as their surface.

Three pieces of background are needed:

- Volume of a tetrahedron: , where
*a*stands for the edge length in a regular tetrahedron. - Radius of circumsphere: , where
*a*stands for the edge length in a regular tetrahedron. - Dihedral angle in a regular tetrahedron:

Using scripts, that information is used in the screenshots below.
Note that *Houdini* does not allow to set the *Min Dihedral Angle* larger than
60.

### Uniform Tetrahedralization Via Second Input¶

The *Tetrahedralize* node takes an optional second input, which provides points
that must be incorporated for the tetrahedralization.
This is a way to completely customize the resulting tetrahedron layout.
Such points can be provided in multiple ways, one of them being by a *Points
from Volume* node.
This node samples points from the volume contained in the closed-surface input
geometry.

This method can be used to achieve a regular tetrahedralization on a grid layout. For that, start from a uniform cube.

Then attach a *Points from Volume* node.

Per default, the points are uniformly distributed in space, therefore, the resulting tetrahedralization is uniform in size and shape.

Note

- There are use cases where such a pattern is wanted, but for most scenarios, a randomized pattern of equally sized tetrahedrons is required as it does not induce a structural anisotropy.
- Tetra Setup demonstrates how to group multiple simple cubes together to avoid anisotropic deformation predispositions.

If a non-uniform inner tetrahedron layout is wanted, applying jitter in the
*Points from Volume* can be very helpful.
A combination of *Jitter Seed* and *Jitter Value* achieves results as shown
below.

For further information on the *Houdini Tetrahedralize* nodes, please refer to
their reference pages.