e5db24043403e33cf170e987425c949712841b56
**Problem Description** Blender's current mesh data layout often lacks spatial coherence, causing performance bottlenecks during BVH construction for sculpting and painting operations. Each time a BVH is built, the system must recompute spatial partitioning and vertex groupings from scratch, leading to redundant calculations and suboptimal memory access patterns. **Proposed Solution** This patch implements pre-computed spatial organization of mesh data through a new `mesh_apply_spatial_organization()` function that: - Reorders vertices and faces based on spatial locality using recursive spatial partitioning. - Stores pre-computed MeshGroup hierarchies in MeshRuntime for reuse. - Enables the BVH system to bypass expensive spatial computation when pre-organized data is available. This approach separates the expensive spatial computation from more frequent BVH rebuilds, providing sustained performance improvements across multiple sculpting operations. **Limitations** - Requires manual invocation (occurs automatically only during remesh operations). - Additional memory overhead for storing MeshGroup metadata. - One-time computational cost during initial organization. - Spatial group references are not yet stored in files. **User Interface** The feature is accessible via a new "Reorder Mesh Spatially" operator in the Mesh Data Properties panel under the Geometry Data section. Users can invoke it manually when needed, or it will be applied automatically during quadriflow and voxel remesh operations. The operator provides feedback confirming successful spatial reordering. Pull Request: https://projects.blender.org/blender/blender/pulls/139536
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline—modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
