Upgrading to 7.4 with respect to deflection changes

I noticed my meshes are not looking as good in 7.4 as in 7.3. The release notes for 7.4 say, "In the new version deflection is controlled more accurately. Due to this improvement it may be necessary to tune parameters of call of the BRepMesh algorithm on the application side to obtain the same visual quality of presentation and/or performance as before." Are there any details on what changed from 7.3 to 7.4 so that on the application side we can keep the meshing output as similar in quality to that of 7.3?

BENJAMIN NUERNBERGER's picture

I noticed this when importing motorcycle.STEP from https://grabcad.com/library/custom-naked-motorcycle. Some parts seem to look worse and some parts look better (and correspondingly they have less/more triangles). For example, the tires went from ~40k triangles (7.3) down to ~15k triangles (7.4). On the other hand, a part called "Back pipe mid" went from 340 triangles (7.3) up to 408 triangles (7.4). Is there any guide on how to update the tessellation parameters appropriately in upgrading from 7.3 to 7.4?

BENJAMIN NUERNBERGER's picture

I did find both the "Meshing" and "Upgrade to OCCT 7.4.0" sections of the doxygen. However, neither appear to have any details on how to appropriately adjust the parameters. Has the meshing algorithm changed drastically enough that it's simply too complicated to explain how to tune the parameters to match 7.3.0 meshes?

Regardless, which parameters need updating? Is it just the linear and angular deflection parameters?

Kirill Gavrilov's picture

This is not like "previously, deflection parameter was accidentially divided by 2x factor everywhere".
The changes are deep inside in the algorithm, so that effect of bugfixes is collateral to visual quality.

  1. If mesh is created for using in algorithm - there is nothing to worry, as soon as your deflection parameters meet tolerance criteria of your algorithm.
    The side effect of bugfixes and improvements is smaller mesh, thus faster algorithm.
  2. If mesh is created only for visualization, the visual quality might slightly degrade due to stricter following to deflection parameters.
    As visual quality is subjective, you need to play with parameters (or keep them as is) to find out which one looks sufficient for your users - the same as for earlier versions of OCCT. Normally, application also provides an option for selecting visual quality (like low, normal, high mapped to BRepMesh parameters in some way), so that user may choose between quality and performance basing on his needs and performance of his computer.

As far as I know, angular deflection was not affected, so that most likely only linear deflection should be adjusted.
But as these parameters work together (the stricter one dominates over weaker for particular part of a shape), you may play with both.
Be aware of the difference between absolute (recommended, when you know sizes of your models)
and relative linear deflection (based on bounding box of a shape - a workaround for displaying shapes of unknown size).

If you are confused by the meaning of these parameters - check the documentation.

Kirill Gavrilov's picture

Visual quality also depends on rendering parameters - make sure you are using Graphic3d_TOSM_PBR or Graphic3d_TOSM_FRAGMENT shading model (V3d_View::SetShadingModel()) instead of old Graphic3d_TOSM_VERTEX.

BENJAMIN NUERNBERGER's picture

Thank you, Kirill, for the quick response! That makes sense to me. I'll play around with the parameters and see what I can get.

BENJAMIN NUERNBERGER's picture

Just to verify, IMeshTools_Parameters.Angle is in radians, correct? Does that mean the default of 0.5 is 28.6479 degrees? However, the documentation says, "Angular deflection is relatively simple and allows using a default value (12-20 degrees)".

Kirill Gavrilov's picture

All angles passed to OCCT algorithms should be in radians with rare (hopefully all documented) exceptions.
12-20 degrees most likely refer not to IMeshTools_Parameters constructor, but to parameters used in OCCT 3D Viewer (defined in Prs3d_Drawer constructor and passed to BRepMesh within AIS_Shape presentation builder).