Blender Git Loki
Git Commits -> Revision 399b6ec
Revision 399b6ec by Campbell Barton (master) August 13, 2021, 00:21 (GMT) |
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 |
Commit Details:
Full Hash: 399b6ec76c80a8f343747a0459bb3d3df514555f
Parent Commit: 1275ce6
Lines Changed: +82, -53
1 Modified Path:
/source/blender/blenkernel/intern/mesh_normals.cc (+82, -53) (Diff)