Optimizing normals: using OPTIMIZE_KEEP_NORMALS flag

Question and answer about Polygon Cruncher SDK
Post Reply
Site Admin
Posts: 282
Joined: Thu Jul 05, 2007 11:06 am

Optimizing normals: using OPTIMIZE_KEEP_NORMALS flag

Post by mootools » Tue Nov 23, 2021 1:49 pm

Normals is one of the more sensitive aspect of optimization.
Most of the mesh are provided without user normals. In such case, the Polygon Cruncher generates some normals for the file.
This is what we call auto generated normals.

In such case, OPTIMIZE_KEEP_NORMALS is not recommended as normal are generated automatically.
Adding OPTIMIZE_KEEP_NORMALS during optimization is an additional constraint which might give less interesting results.

When some users normals are defined, this can be important to activate OPTIMIZE_KEEP_NORMALS.
OPTIMIZE_KEEP_NORMALS works in conjunction with the normal threshold which can be set using

Code: Select all

CSceneOptimizer::SetNormalThreshold(double radianThreshold).

By default the normal threshold is set to 10.0 degree (converted to radian).

What does the threshold means?

Consider this car door.

normalSeam.png (15.05 KiB) Viewed 27473 times

This door embed user normals that were created to force an hard edge line along the door.
We would like to make the optimizer consider this line as a seams and prevent moving the points on that line during optimization.

This is what we can do using the normal tolerance value combined to the OPTIMIZE_KEEP_NORMALS, OPTIMIZE_PROTECT_NORMALS or OPTIMIZE_EXCLUDE_NORMALS flags.
If you use one OPTIMIZE_KEEP_NORMALS / OPTIMIZE_PROTECT_NORMALS the point belonging to that line might move but there is a penalty for moving them.
If you use OPTIMIZE_EXCLUDE_NORMALS the point are locked.

Here is the point that are impacted by this flags when you set the threshold to 10.0°.

normalProtect10.png (30.65 KiB) Viewed 27473 times

If you set a lower threshold, you'll get more impacted points:

normalProtect2.png (29.99 KiB) Viewed 27473 times

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest