SIGMA

Scalable Interfaces for Geometry and Mesh based Applications

Improving ray tracing performance

Posted by in CGM, MOAB

For some geometries with complex boundaries and many geometry entities, ray-tracing can take too long time. By controlling some options related to geometry faceting process, we can improve the performance and investigate where the problem comes from.
You may see a performance improvement if you set a maximum facet edge length. The dagmc_preproc tool can do this. It basically works like mbconvert, but accepts three tolerance-related options:
1. –ftol <val> : the faceting distance tolerance (the one we most typically refer to as “faceting tolerance”). specifies maximum distance from facets to underlying geometry
2. –ltol <val> : the faceting edge length tolerance. Facet edges ought not to exceed this length. Note that the faceter sometimes ignores this value, but it’s worth trying if you have performance problems.
3. –atol <val> : the faceting angle tolerance. It hasn’t been seen a use case yet where it was particularly helpful for performance improvement.
You can get more details on all of these by running dagmc_preproc --help.
There are some more advanced ways of using dagmc_preproc to generate visualizations of the OBB trees that are used to accelerate ray firing.
For basic OBB statistics, put your geometry into dagmc_preproc with the -S flag (add the -v flag for extra information). The key thing that -S will tell you about is how many OBB leaves have a large number of triangles in them. Such leaves are often the source of performance pathologies, especially if many rays pass close to them. If you have large OBB leaves with 100s or 1000s of triangles, they are probably contributing to your performance woes. A geometrically small leaf with lots of triangles is less of a problem.
The -O flag will let you visualize the locations of problematic OBB leaves. When given -O <filename>, dagmc_preproc writes a file with an NxNxN grid of boxes (N=50 by default; N can be set with the –obb-vis-divs option). Each box has the LEAFTRIS tag set. This tag indicates the number of triangles that reside in leafs which intersect the box. In areas where LEAFTRIS is large, ray performance will be poor, because many ray-triangle intersection tests will be necessary. To aid in visualization and for memory reasons, no boxes are created where LEAFTRIS is zero.
Both the -S and -O flags can be limited to specific volumes using the -V flag. This is most useful when you have many volumes.
The basic workflow for tracking down a performance pathology is:
1. use dagmc_preproc -S : to find the volume or volumes that have the messiest OBB leaves.
2. use dagmc_preproc -O : your_vis_file.vtk -V <volumes> on those volumes to see the locations where the OBB leaves are worst.
You can also do mb_convert -v <volumes> to export the faceting of the volumes of interest. If the triangles aren’t too small, the faceted geometry can be visualized in Paraview or Visit alongside the LEAFTRIS visualization created by dagmc_preproc.


Copyright © 2014--2023 SIGMA. All Rights Reserved.