Skip to content
All posts

Reduction

Isotropic reduction and remeshing

In this blog, we will look at how to improve performance by encouraging more equilateral triangles with Simplygon's new isotropicity setting. We will explore how to use it in the remesher and reducer, and what the trade-offs are.

Isotropic reduction and remeshing

Disclaimer: The code in this post is written using version 10.4.446.0 of Simplygon. If you encounter this post at a later stage, some of the API calls might have changed. However, the core concepts should still remain valid.

What is isotropicity?

Let us start by explaining some of the terminology we will use in this blog.

We use isotropicity as a measure of how close the triangles in a model are to being equilateral. In an equilateral triangle, all three angles are 60 degrees. In the image below, the highlighted triangle on the left is a good example of a nearly equilateral triangle.

Mesh with a nearly equilateral triangle highlighted on the left and a long, thin sliver triangle highlighted on the right.

On the right, we have the opposite: a long, thin triangle. These are often called sliver triangles or skinny triangles.

Our isotropicity setting controls the penalty for non-equilateral triangles. It is worth mentioning that the penalty is not linear: a very sharp angle is penalized much more heavily.

Why we want models with equilateral triangles

So why have we introduced a new setting to control isotropicity? There are many good reasons to prefer models with equilateral triangles and to avoid sliver triangles.

  • In deformable meshes, such as those used in cloth simulation, sliver triangles introduce artifacts during deformation. Equilateral triangles are preferred.
  • Sliver triangles cause high quad overdraw. A long sliver triangle can partially cover many 2×2-pixel quads, forcing the GPU to shade all four pixels in each quad even if only one is used. To reduce quad overdraw, we want large, equilateral triangles. This is covered in more depth in the talk Art optimization in the 41st millennium, which we gave together with Fatshark at GDC 2023.
  • For ray tracing, long sliver triangles cause issues in acceleration structures. A sliver triangle can have a large bounding volume containing mostly empty space. This causes many failed intersection tests. You can read more about this in NVIDIA's blog post Creating Optimal Meshes for Ray Tracing. As expected, equilateral triangles are preferred.

Isotropic reduction

Isotropicity has been available as a setting in Simplygon's High Density Mesh Reducer since Simplygon 10.4.169.0.

Let us run an experiment to see how it works. We will reduce a model to the same triangle count using different isotropicity settings. We will use this highly tessellated box with 17 k triangles and reduce it to 25% of its original triangle count. We will test isotropicity at its default value of 0.01 and at 1.00.

Original
Original
Reduced to 25% with isotropicity 0.01
Reduced to 25% with isotropicity 0.01
Original
Original
Reduced to 25% with isotropicity 1.00
Reduced to 25% with isotropicity 1.00

Since we are using the same reduction ratio, both output models have approximately the same triangle count: 4 k triangles.

  • With low isotropicity, we get different tessellation densities in different parts of the model. Large, flat areas have large triangles, while areas with more variation in shape have more, smaller triangles. We can also see some sliver triangles.

  • With high isotropicity, our asset is more evenly tessellated. We do not see a large difference between areas with more variation in shape and flat areas. However, some areas, such as the top-right corner, are not as well preserved. No sliver triangles are visible.

So which optimization is better? The answer depends on our use case for the box and what we are optimizing for. Our GPU would probably prefer the asset with high isotropicity, assuming that the benefit of having large triangles in some areas does not outweigh the benefit of having more equilateral triangles. However, leaving isotropicity at its default value gives us a better-looking asset, which we could probably display closer to the camera.

Like most other reduction settings, isotropicity is not a setting we can simply max out. We want to balance the preference for equilateral triangles against everything else we strive to preserve during reduction.

Reduction is constrained by the original topology

One observation we can make from above is that a side effect of having equalateral triangles is that we get triangles of around the same size. It is worth mentioning that setting isotropicity to 1.00 does not guarantee even tessellation of the model. We are optimizing the model by removing triangles from the original geometry, not introducing new triangles to make it more evenly tessellated.

Let us look at this jerrycan example. We reduce it to 25% of its original triangle count with isotropicity set to 1.00.

Original
Original
Reduced to 25% with isotropicity 1.00
Reduced to 25% with isotropicity 1.00

After optimization, we still have areas with large triangles, areas with small triangles, and some remaining sliver triangles. When choosing which triangles to remove, we have given isotropicity a high priority, but we are constrained by the original geometry.

Isotropicity with OnScreenSize and MaxDeviation reduction targets

Above, we tested how isotropicity behaves with triangle ratio as the reduction target. Perhaps unsurprisingly, the model is still reduced to the same triangle count regardless of the isotropicity setting. This is also the case when we target a specific triangle count.

But what happens if we target a specific OnScreenSize or MaxDeviation? Since these reduction targets are different ways of expressing the same metric, deviation, we only need to test one of them.

Original
Original
Reduced to MaxDeviation 0.03 with isotropicity 0.01
Reduced to MaxDeviation 0.03 with isotropicity 0.01
Reduced to MaxDeviation 0.03 with isotropicity 0.01
Reduced to MaxDeviation 0.03 with isotropicity 0.01
Reduced to MaxDeviation 0.03 with isotropicity 0.30
Reduced to MaxDeviation 0.03 with isotropicity 0.30
Reduced to MaxDeviation 0.03 with isotropicity 0.30
Reduced to MaxDeviation 0.03 with isotropicity 0.30
Reduced to MaxDeviation 0.03 with isotropicity 0.60
Reduced to MaxDeviation 0.03 with isotropicity 0.60
Reduced to MaxDeviation 0.03 with isotropicity 0.60
Reduced to MaxDeviation 0.03 with isotropicity 0.60
Reduced to MaxDeviation 0.03 with isotropicity 1.00
Reduced to MaxDeviation 0.03 with isotropicity 1.00

We might be a bit surprised when we look at the resulting triangle counts. Raising isotropicity above the default value of 0.01 increases the resulting triangle count, but the increase is not strictly monotonic. In our case, setting isotropicity to 1.00 gave a lower triangle count than setting it to 0.30 or 0.60.

Model Isotropicity Triangle count
Original - 79 k
Reduced to MaxDeviation 0.03 0.01 7.6 k
Reduced to MaxDeviation 0.03 0.30 9.8 k
Reduced to MaxDeviation 0.03 0.60 10.1 k
Reduced to MaxDeviation 0.03 1.00 9.3 k

Here is what happened. Triangle reduction is performed in steps. At each step, the reducer prioritizes triangle removals that strike a good balance between introduced deviation and isotropicity. In our case, favoring more equilateral triangles at an earlier step allowed the reducer to make a series of decisions that led to a lower overall triangle count.

On average, we expect a higher isotropicity value to increase the triangle count. If we repeated this experiment with a large set of assets, we would expect triangle counts to increase on average with higher isotropicity settings. It is not possible to assign a fixed cost to isotropicity in terms of triangle count. The cost depends on how difficult it is to represent the asset using nearly equilateral triangles.

Isotropic remeshing

Isotropicity was added as a setting in the remesher in Simplygon 10.4.431.0. It works the same way as in reduction: it tries to make triangles as close to equilateral as possible while minimizing deviation.

Let us look at an example. Here, we want to create an HLOD proxy for a building. We will remesh it to an OnScreenSize of 200. We are also using a visibility hemisphere to cull interior geometry. We will compare isotropicity values of 0.01 and 0.50.

Original
Original
Remeshed to 200 pixels with isotropicity 0.01
Remeshed to 200 pixels with isotropicity 0.01

Here, we can see some sliver triangles in the resulting model, which is something we want to avoid.

Original
Original
Remeshed to 200 pixels with isotropicity 0.50
Remeshed to 200 pixels with isotropicity 0.50

With isotropicity set to a higher value, we get fewer sliver triangles. But what happens if we max it out? Let us set isotropicity to 1.00 and see what happens.

Original
Original
Remeshed to 200 pixels with isotropicity 1.00
Remeshed to 200 pixels with isotropicity 1.00

Here, the model takes on an almost organic-looking topology, and its silhouette starts to degrade. It is difficult to represent this shape using equilateral triangles. Now let us compare the results of our experiments.

Model Isotropicity Triangle count
Original - 64 k
Remeshed to 200 pixels 0.01 4 k
Remeshed to 200 pixels 0.50 6 k
Remeshed to 200 pixels 1.00 16 k

If we used this proxy model for an advanced, trippy deformation effect, the version with the highest isotropicity setting would probably give us the best-looking effect. However, this comes at the cost of a higher triangle count. A moderate isotropicity value lets us spend some extra triangles to avoid sliver triangles. Just as with reduction, the best proxy model depends on our use case.

Final thoughts

One reflection after writing this blog is that not all triangles are equal (or equilateral). This means that we cannot focus solely on triangle count when assessing how well optimized a model is. This is a topic I have touched on in many other blog posts, including What is the right reduction target for LOD creation. That post focused on how different assets can be reduced to different levels depending on their topology.

Isotropicity adds another dimension to this: we can optimize the same asset to the same triangle count using different isotropicity settings. The resulting variants can differ in both visual quality and rendering performance.

  • Differences in visual quality are taken into account when using OnScreenSize or MaxDeviation as reduction targets. Increasing isotropicity should, on average, increase the resulting triangle count while keeping visual quality at approximately the same level.
  • If we increase isotropicity in a pipeline with triangle ratio or triangle count as the reduction target, we get the same resulting triangle count, but probably a worse-looking model. We should use the scene's GetCustomFieldMaxDeviation method to calculate when to display the LOD. This is covered in the blog post Calculating LOD transitions when using triangle ratio as reduction target.

When choosing a suitable isotropicity value, we should not focus on individual assets in isolation. Instead, we should use a representative set of assets and find a value that works well across them, while carefully benchmarking rendering performance in a representative scene.

All posts