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 https://wiki.blender.org/index.php/Dev:2.8/Viewport#Discussion_Items). 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
1 Added Path:
/source/blender/editors/space_view3d/view3d_bvh.c (+165, -0) (View)
13 Modified Paths:
/source/blender/blenkernel/BKE_camera.h (+2, -0) (Diff)
/source/blender/blenkernel/BKE_object.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/camera.c (+38, -0) (Diff)
/source/blender/blenkernel/intern/object.c (+32, -0) (Diff)
/source/blender/blenkernel/intern/pbvh.c (+3, -3) (Diff)
/source/blender/editors/space_view3d/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/space_view3d/space_view3d.c (+4, -0) (Diff)
/source/blender/editors/space_view3d/view3d_draw.c (+8, -0) (Diff)
/source/blender/editors/space_view3d/view3d_intern.h (+10, -0) (Diff)
/source/blender/editors/space_view3d/view3d_select.c (+16, -0) (Diff)
/source/blender/gpu/GPU_buffers.h (+4, -4) (Diff)
/source/blender/gpu/intern/gpu_buffers.c (+8, -5) (Diff)
/source/blender/makesdna/DNA_view3d_types.h (+3, -0) (Diff)
/source/blender/blenkernel/BKE_object.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/camera.c (+38, -0) (Diff)
/source/blender/blenkernel/intern/object.c (+32, -0) (Diff)
/source/blender/blenkernel/intern/pbvh.c (+3, -3) (Diff)
/source/blender/editors/space_view3d/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/space_view3d/space_view3d.c (+4, -0) (Diff)
/source/blender/editors/space_view3d/view3d_draw.c (+8, -0) (Diff)
/source/blender/editors/space_view3d/view3d_intern.h (+10, -0) (Diff)
/source/blender/editors/space_view3d/view3d_select.c (+16, -0) (Diff)
/source/blender/gpu/GPU_buffers.h (+4, -4) (Diff)
/source/blender/gpu/intern/gpu_buffers.c (+8, -5) (Diff)
/source/blender/makesdna/DNA_view3d_types.h (+3, -0) (Diff)