Blender Git Loki

Git Commits -> Revision 695da4f

Revision 695da4f by Julian Eisel (viewport_bvh_select)
August 25, 2016, 15:21 (GMT)
Initial BVH based object mode selection

As part of the viewport project, we wanted to switch from OpenGL based to BVH based selection (see This should increase performance and make selection drawing and hence driver independent. (OpenGL selection was always an issue with buggy drivers.)

This commit adds initial functions for building and visualizing an object BVH (AABB) using the multi-threaded BLI_bvhtree and uses it for object mode selecting. Only basic selection works now, not taking care for movie clip editor selection syncing or so. One idea was to keep the actual BVH part a bit separate from selection, so that it can be reused e.g. for culling out objects out of view frustum before drawing.
Quite some speedup is already visible, but it's not fair to compare to previous selection, since we're only doing bounding box intesection checks currently. Detailed geometry intersection checks are not done yet, neither are overlapping objects handled.

One issue I faced was that some object types (cameras, lamps, speakers) are basically infinite small points with no visible bounding box. I added some functions to get the visual bounding box for those, but only implemented it for cameras so far.

Main TODOs I can see (random order):
* Selection should behave just like current OpenGL based selection.
* Lasso, Circle & Box select.
* The BVH tree is currently recreated on every redraw, more reasonable updating needs to be checked on. It's unsure if it's better to commonly recreate the entire tree or if we can use some more advanced caching and updating. The BLI_bvhtree isn't really flexible when it comes to updating (e.g. you can't insert objects after initial creating), so maybe adding a different BVH type will be needed.
* Do more detailed geometry intersection checks. OpenSubdiv needs some special attention here, since its geometry only lives on the GPU (AFAIK). It should be possible to send geometry patches from GPU to CPU so we can create AABBs for BVH ray casting.
* Better handling for overlapping geometry.
* BVH based selection for other modes (edit mode, pose mode, etc). I'd like to make the edit mode BVH lookups efficient enough to allow performant pre-selection highlighting.
* Allow selecting lamps and speakers (not possible currently).

Commit Details:

Full Hash: 695da4fd62a4ade9c47005ca032930ff3dabb28c
Parent Commit: e484fe8
Lines Changed: +297, -12

Tehnyt: Miika HämäläinenViimeksi p?ivitetty: 07.11.2014 14:18 MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021