## Teigha PRC: Decompressing Tesselations

Artem Skripko

June 08, 2017

Tags: prc compression/decompression

In Teigha PRC, an OdPrcHighlyCompressed3dTess can be decompressed into an OdPrc3dTess.

To do it:

- Select “Decompress tessellation”.
- Specify the tessellation options.
- Click OK.

All OdPrcHighlyCompressed3dTess tessellations in your file will be replaced with OdPrc3dTess tesselations.

Tessellation decompression also can be done with the following function:

`static void OdPrcFile::decompressCompressed3dTess(OdPrcFilePtr& pFile, const Decompress3dTessParams & params);`

#### Decompression options

- Store normals — Determines whether normals should be stored in the resulting OdPrc3dTess. If set to false, the crease angle value is written to the file and normals will be calculated according to the crease angle value later. It is best to set this value to false because it makes the size of the resulting file smaller. If the tessellation already has calculated normals, they are stored anyway.
- Overwrite crease angle — Overwrites crease angle of all OdPrcHighlyCompressed3dTess tessellations in the file and assigns the specified crease angle value.
- Crease angle value — Double value in the range [0. to 90.] degrees, and used only if “Overwrite crease angle” is set to true.

#### About crease angles

The crease angle is a threshold angle between two faces:

- If face angle >= crease angle, uses facet shading.
- If face angle < crease angle, uses smooth shading.

When recalculating the normals at points, the angle between two adjacent triangles is calculated and compared to the crease angle. If it is below the crease angle, the normal would be shared at this point for the two triangles; otherwise, two distinct normals will exist.

For example, a crease angle of .5 radians means that an edge between two adjacent polygonal faces will be smooth shaded if the geometric normals of the two faces form an angle that is less than .5 radians. Otherwise, the faces will appear faceted. Crease angles must be greater than or equal to 0.0.