Decimate to Target
In 3D data preparation, it is often important to be able to control the triangle count of your model, because of the device performances that will display the model, for instance (e.g. a maximum of 100 000 triangles is advised for HoloLens.
That is the purpose of the `Decimate To Target` function: the user can conform the model's triangle count to his need.
This powerful and important function was improved to have more control over the decimation process than solely the triangle count target to control the quality of the resulting mesh.
In Pixyz Plugin for Unity 2020.2, the user can use weights, in order to preserve specific attributes of his model. Default settings should give good results for any 3D model, but you can play with the 5 different weights to fit the function's behavior to your need, and to preserve specific attributes like normals or UVs (for texture preservation).
TIP For example, a `Game` character with textures applied on it will need to have its UVs preserved whilst decimating. For `CAD` models, it can be more important to preserve hard edges and Normals.
Things to know about this function
Although this algorithm operates at Mesh level, it is based on the whole set of Meshes to evaluate the ratio or the triangle count. It means that calling the function with a list of 10 meshes is different that calling 10 times the function with a single mesh each time. In the first case, the target will be reached for the whole set of mesh, while it will be reached for each mesh individually in the second case.
TIP For AEC, it is advised to call the function a single time with a list of all of the meshes, so that meshes made of a very few triangles such as walls are kept intact while the decimation focuses on denser meshes. Otherwise, you can use the Rule Engine to apply decimation on each GameObject at on
On large models, this function can consume a lot of memory! Make sure you have sufficient memory, or your CPU might swap and slow down the process dramatically.
Advanced parameters: Weights
- Strategy: Between Ratio or TriangleCount
- Use Vertex Weight: if true, the function uses colored vertices to preserve edges connected to these vertices from being deleted. Only vertices painted with a Red color (1, 0, 0) are considered.
The left model vertices are painted with Polybrush, the center model is decimated without using vertex weight, the right model is decimated using vertex weight. The red area is preserved.
WARNING Some shaders can assign a default White value (1, 1, 1) to vertices. So the function takes in reality the difference between R and B as a vertex weight.
- Boundary Weight: This weight defines how important the edges defining the mesh boundaries (free edges) are during the decimation process, to preserve them from distortion
- Normal Weight: This weight defines how important vertex normals are during the decimation process, to preserve the smoothing of the mesh from being damaged.
TIP : For Automotive models, (the car body, hood, etc..) The Normal Weight should be set as very important
- UV Weight: This weight defines how important UVs (texture coordinates) are during the decimation process, to preserve them from being distorted (along with the textures using the UVs)
- Sharp Normal Weight: This weight defines how important sharp edges (or hard edges) are during the decimation process, to preserve them from being distorted
- UV Seam Weight: This weight defines how important UV seams (UV islands contours) are during the decimation process, to preserve them from being distorted (along with the textures using the UVs)
- Forbid UV Foldovers: This parameter forbids UVs to fold over and overlap each other during the decimation