Sometimes, BREP data will only be loaded into a file. In this case, Exchange can generate tessellation data. You can also choose to re-tesselate the tessellation data that is provided in the source file as long as BREP is also available. You can only Tessellate from BREP in Exchange because the tessellation uses the BREP as its source of truth for its algorithms. If you need to modify or change tessellation from a file that does not include BREP, the best solution would be leveraging Polygonica or a similar software solution.
BREP Correlation to Tessellation
The tessellation algorithm generates a 1:1 ratio of BREP Edges to Tessellation Loops and BREP Faces to Tessellation Faces. These have direct corollary associations for each, which means for example that the third BREP Edge in the BREP structure is the same geometry representation as the third Tessellation Loop in the tessellation structure. The same goes for the faces where the nth BREP Face is the same geometry representation as the nth Tessellation Face.
Internal Parameters for Generating Surface Meshes
Two main parameters are used to control the meshing
- Chordal error: it is the maximum distance between the geometry (BREP) and the mesh
- Angle error: it is the maximum angle between two segments of a tessellated edge.
- It is useful to preserve a good looking to small shapes even if they are very small, (smaller than the chordal error).
Controlling Chordal Errors
There are 2 ways of controlling a chordal error:
- By setting the chordal error limits directly: Setting the m_bUseHeightInsteadOfRatio equal to True m_dMaxChordHeight to a value. This is “dangerous” (for the chordal error) because if you set this to a value too small compared to the size of your model, it can generates huge meshes (extremely large data sets that are unmanageable). This DOES NOT WORK WELL FOR AUTOMATED WORKFLOWS SINCE IT CANNOT GENERICALLY APPLY TO ALL CASES.
- By using a ratio: Set this by setting m_dChordHeightRatio. A chordal error will be computed for each representation item by computing a fraction of its bounding box dimension for the max Chordal Height, i.e. a ratio of the size of the model to the accuracy at the smallest node to keep the model size manageable.
Controlling the Internal Parameters with the Tessellation Options
The most important option is m_eTessellationLevelOfDetail which has the following options:
- kA3DTessLODExtraLow, kA3DTessLODLow, kA3DTessLODMedium, kA3DTessLODHigh or kA3DTessLODExtraHigh: some adapted values of chordal ratio (fraction of the bounding boxes) and angle error will be used, see this table in the docs for how these ratios are leveraged.
- kA3DTessLODUserDefined : you’ll specify directly m_dChordHeightRatio and m_dAngleToleranceDeg.
Once the chord error and angle error have be set, then, used by the different tessellation algorithms we have:
- Standard algorithm, made for visualization: fast, chordal error not guaranteed and not watertight. (default one)
- Accurate tessellation algorithm (enabled by m_bAccurateTessellation), slower, distances from triangles and geometry checked, watertight. (no T-junctions, tessellations of adjacent faces are no more independent)
- when tessellation accurate is enabled, you can force triangles in the direction of the smallest surface curvature with m_bAccurateSurfaceCurvatures
- you can disable the accurate tessellation vertices normal computation, if it is useless ( m_bDoNotComputeNormalsInAccurateTessellation )
- Accurate tessellation actually checks the distances between the triangles and the geometry, it cannot be asked to achieve a precision smaller than the topolopy tolerances (brep tolerance or edge/vertex tolerances if it has been redefined locally), as a consequence we limit the precision of the tessellation in that case (with a log warning).
- Adding a Grid:
- the accurate tessellation algorithm uses a very naïve vertex insertion method to refine the mesh until reaching the criteria and produces nonaligned triangles (was sufficient for computation when only the chordal error and the watertightness is important). If you need aligned triangles, you can enabled m_bAccurateTessellationWithGrid to force every inner face vertices to be located on a parametric grid. Even with that grid mode, there will be less triangles in flat areas to match the chordal error, but if you want a more uniform mesh, you can specify a m_dAccurateTessellationWithGridMaximumStitchLength.
- With m_bKeepUVPoints, for each tessellation vertex (3d point), you can get the corresponding parametric point (2d) on its face surface domain. (useful for computations or texture mapping)
- m_dMaximalTriangleEdgeLength activates a post-treatment that splits triangles until they are smaller than a given length. (Only produces filiform triangles, not recommended)
- m_dMinimalTriangleAngleDeg (deprecated, was used in another deprecated tessellation method)