[Bf-committers] Occlusion Query based selection

Antony Riakiotakis kalast at gmail.com
Thu Mar 29 18:52:08 CEST 2012

Time to resurrect this little thread.

Here is a patch that uses a draw twice method to select the first
possible object.
First I draw a small part of the framebuffer with depth test less or
equal and on the second pass, where I have the depth information, I
use an equal test. I differentiate between two selection methods:
Select first and enumerate. Obviously, only the select first method
uses the two-pass method, and in this case I only redraw objects that
passed the first pass test, saving some frame rate.

I ended up touching quite a few parts of blender to make this work and
i still feel it is more hacky and prone to break than i would like it
to be. Parts liable to break are depth-using effects (like Jason
Wilkins' on surface brush for instance), solvable through an offscreen
buffer for selection (possibly reusable and allocated at startup), and
the object skipping code for the second pass that relies on the order
of drawable objects being the same. For instance, objects that change
selection ID while drawn can foil the optimization. Also I may have
inappropriately tagged different selection methods as "enumerate" or
"select first". A few pairs of eyes are welcome there too.

So a review is welcome. The patch is located at:


More information about the Bf-committers mailing list