b1c7b573c0
Function Module Inclusive Time Exclusive Time -------------------------------------------------------------------------- mesh_render_data_update_normals blender 297.51 0.00 315 -> 297 acos() usage in all places related to normal calculations shows up in the profiler. Given that "angle between faces" is only additional heuristic weight in there (the effect of it at all is very subtle), approximate but faster version of acos() might be just fine. Especially since some other parts of Blender (e.g. mikktspace) use approximate acos in a conceptually the same part. - Adds safe_acos_approx() to BLI_math_base.hh. Implementation the same as already exists in Cycles; max error 0.00258 degrees. Between 2x and 4x faster in my tests. - Changes all normals related calculations to use the function above instead of saacos. Computing normals on a Stanford Lucy (14m verts) mesh: - Mac (arm64, M1 Max): 247ms -> 229ms - Win (x64, Ryzen 5950X): 276ms -> 250ms All places that are about "normal calculation" were changed, including e.g. Corrective Smooth modifier. Applying that one to the same 14m vertices mesh, Mac M1 Max: 9.96s -> 9.76s Tiny changes in several test output expectations w.r.t. normals are observed, these were reviewed and updated expectations checked in svn. Pull Request: https://projects.blender.org/blender/blender/pulls/114501