# Attribute Tessellation

## Overview

Simplygon 10 adds support for storing geometry attributes at a higher frequency than the geometry frequency (per-vertex, per-corner or per-triangle). The attributes are tessellated per-triangle in a barycentric grid, which is uniformly subdivided. Each triangle is independently subdivided and stores attribute data at the selected frequency. Each consecutive level of subdivision multiplies the number of tessellated triangles by 4. Below are examples of the first 3 levels (0-2) of subdivision.

Attributes can be either stored in the tessellated triangles, or in the tessellated vertices of the subdivided triangle, as shown below for the same 3 levels of subdivision. Tessellated vertices on the edges of subdivided triangles are duplicated, and are unique to each subdivided triangle.

Please note that the number of tessellated attributes differ depending on storing them in the tessellated vertices or triangles. Also note that the centroid of each triangle is not uniformly positioned on the barycentric grid, but the vertices are. However, each tessellated triangle has the exact same shape and area, and a randomly chosen position on each triangle will on average be uniformly distributed on the subdivided triangle.

To calculate the number of tessellated triangles in a specific level, use the formula:

```
Tris = 4 ^ Level
```

Which e.g. gives the tessellation counts 1, 4 and 1024 for levels 0, 1, and 5, respectively.

To calculate the number of tessellated vertices in a specific level, use the formula:

```
Verts = ((2 ^ Level) + 1) * ((2 ^ Level) + 2) / 2
```

Which e.g. gives the tessellation counts 3, 6 and 561 for levels 0, 1, and 5, respectively. As you can see, the number of tessellated vertices grows at a slower pace than tessellated triangles, and will end up at about half the number of triangles at the same subdivision level.

## Attribute Tessellation in processors, pipelines and casters

Simplygon supports setting up attribute tessellation in output scenes from any of the processors or pipelines. Attributes can also be used as a target for material casting. Simplygon can also generate a tessellated output, where the tessellated attributes are converted into actual vertices and triangles, in a more densely tessellated mesh. This is done by using the **AttributeTessellation** tool, and is shown in the **Attribute Tessellation Example**.

The user can choose to uniformly tessellate the output geometry, or select between a number of subdivision density strategies, such as relative or absolute area. Triangles can be subdivided at different levels, and gaps between neighbor triangles at different subdivision levels are removed by welding the edge vertices when generating a subdivided mesh.

In the image below, a high resolution 3D scan is reduced using the spReductionPipeline, and tessellated attributes are set up to cast the displacement, by using the spDisplacementCaster. The subdivision strategy selected is using a "maximum relative area per tessellated value", where each output triangle is subdivided until the relative area of each of the subdivided triangles are below the set threshold. This setting will subdivide larger triangles more than smaller triangles.

## Example

For an example of setting up a reduction pipeline with attribute tessellation and casting of displacement data, see the **Attribute Tessellation Example**.

## Export

Tessellated attributes can be manually extracted from the spGeometryData for use in runtime engines.

Simplygon also supports the NVidia Micromesh technology, and can output displacement attributes into the ".bary" file format, when exporting to glTF file format. Along with the bary file the base mesh data needed to support the Micromesh data is inserted into the glTF file.

## See also

**AttributeTessellationSettings**

The AttributeTessellationSettings settings object for processors and pipelines**AttributeTessellation**

The AttributeTessellation tool