diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-08-13 02:27:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-13 03:21:30 +0300 |
commit | 399b6ec76c80a8f343747a0459bb3d3df514555f (patch) | |
tree | fd36a240ac275e63d231a11ee1c95f1d76d85c86 /source/blender/modifiers/intern/MOD_weighted_normal.c | |
parent | 1275ce61b1b02261f666018866f7061a3f30ce60 (diff) |
Mesh: optimize normal calculation
Optimize mesh normal calculation.
- Remove the intermediate `lnors_weighted` array, accumulate directly
into the normal array using a spin-lock for thread safety.
- Remove single threaded iteration over loops
(normal calculation is now fully multi-threaded).
- Remove stack array (alloca) for pre-calculating edge-directions.
Summary of Performance Characteristics:
- The largest gains are for single high poly meshes, with isolated
normal-calculation benchmarks of meshes over ~1.5 million showing
2x+ speedup, ~25 million polygons are ~2.85x faster.
- Single lower poly meshes (250k polys) can be ~2x slower.
Since these meshes aren't normally a bottleneck,
and this problem isn't noticeable on large scenes,
we considered the performance trade-off reasonable.
- The performance difference reduces with larger scenes,
tests with production files from "Sprite Fight" showing
the same or slightly better overall performance.
NOTE: tested on a AMD Ryzen TR 3970X 32-Core.
For more details & benchmarking scripts, see the patch description.
Reviewed By: mont29
Ref D11993
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weighted_normal.c')
0 files changed, 0 insertions, 0 deletions