2
$\begingroup$

I'd like to understand the technique (in OpenGL) Blender 2.8 uses to draw it's outlines in the 3d View.

So we're clear, I'm talking about the ORANGE outline of the suzanne in the picture below. And specifically, the fact that the orange outline shows "x-ray" style through other objects, like the cube here. How do they do that?

If not for the transparent x-ray, my first guess would be that they use the "scale up backface draw" method.. Where the object is drawn normally, then drawn a second time in the solid orange color, but scaled up slightly and only drawing backfaces. However, this method would not cause x-ray reveal through other objects.

Two ways I can imagine to do the x-ray reveal are:

  1. when drawing the outline pixels, check the data in a screen-space "object picking buffer", to see if the object-id matches the object ID you are outlining. If it does match, then follow normal Z-occlusion rules. If it doesn't match, then draw the outline pixels with a depth of Float.MinValue (aka, a very near-z value) so all outlines will stay in front of everything drawn after
  2. use a separate full-screen "outline buffer", draw all outlines into this buffer, and then do a full screen-space pass to composite the outlines back over the top of the normal framebuffer

Method 1 seems much less costly, and I suspect Blender already has a screen space object-picking buffer... so I suspect this is the method it would use. Can anyone in the know confirm?

enter image description here

$\endgroup$

0

You must log in to answer this question.

Browse other questions tagged .