# Repair Mesh

> How to repair meshes in Asset Transformer Studio

![Repair Mesh](/api/media?file=/asset-transformer-studio/2026.5.0/media/ALGO_RepairMesh.jpg)

A good mesh repair is key for a good optimization.

Before being optimized, a mesh needs to be clean: with connected edges, no overlapping triangles, with triangle faces oriented consistently and in the correct direction, etc.

A simple example showing how important repaired meshes are is decimation: see [this page](../../../data-preparation-fundamentals/about-decimation#repair-meshes).

To repair meshes, use the [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh) function, available in the [Mesh](./_index.md) menu.

## What it does

The [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh) function automatically performs several actions:

### Detect and remove duplicate triangles

Some triangles can be duplicated multiple times and overlapping (meaning with coincident vertices), making the [polycount](http://wiki.polycount.com/wiki/Polygon_Count) too high and potentially creating visual artifacts (Z-fighting).

The process removes them: only one triangle is preserved. This is automatic — no parameter needs to be enabled in the dialog box.

### Vertices welding (proximity tolerance)

This process welds, or merges, together vertices that have the same position (using a tolerance) but different attributes.

Typically, non-manifold borders of a mesh or hard edges are candidates for welding, and the welding will recreate connectivity information at those locations if vertices fall into the given tolerance.

The tolerance is given in the `Tolerance` parameter:

![Tolerance parameter](/api/media?file=/asset-transformer-studio/2026.5.0/media/NewItem433.png)

The default value is 0.1mm and generally gives good results.

### Sew mesh boundaries

To avoid visible gaps and cracks in the input mesh, this process sews (stitches) boundaries that are unconnected:

![Sew boundaries](/api/media?file=/asset-transformer-studio/2026.5.0/media/NewItem28.png) ![Fix T-junction](/api/media?file=/asset-transformer-studio/2026.5.0/media/ALGO_RepairMesh_FixTJunction.gif)

Unconnected boundaries are closed even if the vertices are not coincident, by fixing T-junctions:

![Fix T-junction 2](/api/media?file=/asset-transformer-studio/2026.5.0/media/ALGO_RepairMesh_FixTJunction2.gif)

The tolerance is given in the `Tolerance` parameter (the same value is used for welding and sewing boundaries):

![Tolerance parameter](/api/media?file=/asset-transformer-studio/2026.5.0/media/NewItem433.png)

The default value is 0.1mm and generally gives good results.

If gaps bigger than 0.1mm are observed on the meshes, this value needs to be raised — but not too much, to avoid removing gaps that are part of the mesh topology, like a hole or a marking.

> **Note:**
>
> In Asset Transformer Studio, disconnected edges (also called free boundaries) are represented as blue edges when the [wireframe](../../toolbars/main-toolbar#wireframe) is turned on.

### Removing degenerate triangles

This process removes degenerate triangles, meaning triangles that are almost flat (all boundaries overlapping). This is automatic — no parameter needs to be enabled.

### Fixing orientation of adjacent faces consistently

Orienting triangle faces consistently on a model's meshes is one of the biggest challenges in 3D data preparation.

[Real-time 3D](https://unity.com/solutions/architecture-engineering-construction) apps use single-sided materials (or shaders) in order to preserve performance, by rendering only the faces of the mesh that are visible to the camera/user.

This requires meshes to have their triangle faces properly and consistently oriented (see [About Face and Vertex Normals](../../../data-preparation-fundamentals/about-face-and-vertex-normals)).

In the [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh) dialog box, when the parameter `Orient` is enabled, the [Orient Polygon Faces](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#orientpolygonfaces) algorithm is run, trying to orient all the adjacent faces of each mesh consistently.

This actually does two things: find potential strips of triangles that form a [Möbius strip](https://en.wikipedia.org/wiki/Möbius_strip) and crack it. Then, orient triangles so that all triangles in the same strip are oriented the same way.

![Orient faces](/api/media?file=/asset-transformer-studio/2026.5.0/media/ALGO_RepairMesh_Orient.gif)

> **Note:**
>
> Saying that a face is correctly oriented can often be subjective, as it depends on the position of the viewer. The orientation of the faces in the [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh) algorithm aims at normalizing the orientation on a continuous set of triangles, but it cannot ensure that the final result will be correct for the user.

Although it fixes everything on most volumetric shapes (such as CAD models), the [Orient Polygon Faces](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#orientpolygonfaces) algorithm can have trouble orienting faces properly when dealing with surfaces or shells (as opposed to closed volumes).

To help the algorithm get the best result possible on this kind of mesh, the `Crack Non Manifold` parameter splits non-manifold edges to get two or more manifold edges, when possible.

> **Note:**
>
> Set the parameter `Orient` to false if you are happy with the triangle face orientation and do not want to damage it!

Other functions and methods are available to help orient the faces of a model correctly:

* Automatically or semi-automatically using the dedicated functions in the [Mesh](./_index.md) menu:

  ![Orient functions](/api/media?file=/asset-transformer-studio/2026.5.0/media/NewItem435.png)

  For example, [Orient Faces From Current View](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#orientpolygonfacesfromcamera) and [Orient Faces (Advanced)](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#orientpolygonfacesadvanced) will generate points of view to help get a correct face orientation.

* Manually: by manually selecting faces in the scene with the [Selection](../../toolbars/main-toolbar) mode and using the [**Invert Faces Orientation**](../../window/viewer/viewport-right-click-menus#invert-faces-orientation) command:

  ![Orient selection](/api/media?file=/asset-transformer-studio/2026.5.0/media/ALGO_RepairMesh_OrientSelection.gif)

> **Note:**
>
> To easily spot misoriented triangle faces in the viewport, set the [Backface culling rendering mode](../../toolbars/main-toolbar#rendering-mode) to `BF Color` to draw them with a flat pink color.

## General behavior

The [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh) function repairs the meshes existing in a [part](../../../data-preparation-fundamentals/glossary) independently from other parts of the scene.

So, if 2 mesh boundaries need to be stitched together and if some triangle faces need to be oriented consistently to each other, they need to be in the same part.

Use the merging functions from the [Scene](../scene-menu) menu to merge parts together.

If no [part](../../../data-preparation-fundamentals/glossary) is selected in the scene, Repair Mesh will be executed on all parts of the scene (hidden parts included). If you wish to repair only some targeted parts, select them first.

## Example

Here is an example of a mesh that requires repair: a car door with disconnected edges (blue edges) and inverted triangle faces (pink faces).

Applying the [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh) function with default values repairs the mesh, saving a few triangles, and making it ready for use or further optimization.

![Repair Mesh example](/api/media?file=/asset-transformer-studio/2026.5.0/media/ALGO_RepairMesh_Example.gif)

## To go further

![More repair functions](/api/media?file=/asset-transformer-studio/2026.5.0/media/NewItem434.png)

Beside [Repair Mesh](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#repairmesh), there are many mesh repair functions available. You can find them in the [Function List (F12)](../edit-menu/function-list) in the `Algo` module.

Each subprocess of Repair Mesh explained above can be found as a unitary function, giving more control over the parameterization:

* [Remove Degenerated Polygons](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#removedegeneratedpolygons): removes almost flat polygons (within the given tolerance)
* [Merge Vertices](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#mergevertices): welds vertices (see above)
* [Orient Normals](/asset-transformer-studio/2026.5.0/api/python/algo_functions.md#orientnormals): orients vertex normals consistently with face normals (see [About Face and Vertex Normals](../../../data-preparation-fundamentals/about-face-and-vertex-normals))
