Determining render-order and postprocessing

Dear pandas,

What is the best strategy to draw transparent objects after postprocessing in python script? Right now we have a number of postprocessing effects going on, and the one involving the Z-Buffer (Depth of Field) blurs all the transparent billboarding effects that don’t write to the Z-Buffer. Because of that I’d like to draw these after the postprocessing has already occurred.

For postprocessing I use texturebuffers with sortingorders ranging from -9 to -1 and I’ve tried to put the transparent objects in a ‘fixed’ bin but this doesn’t make a difference. Manually putting the fullscreen-quad in the ‘fixed’ bin also does not work. I’ve tried some Z-Buffer tricks, putting a big transparent quad (with ZWrite enabled) right in front of the camera but in the end it appears that the DOF shader is always executed last.

Best regards,

i got all my effect to work. I use fix’ed bin - did you write your own shader? If you did you can move the post processing to any time and any place in the drawing order.

Could you be more clear on what you are trying to do?

The DisplayRegion makes a difference, too. Panda draws a scene by:

  1. Walk through all of the windows or buffers in order by window->getSort().

  2. For each window (or buffer), walk through all of the DisplayRegions on the window in order by display_region->getSort().

  3. For each DisplayRegion, traverse the associated scene graph. Collect all of the geometry discovered into bins according to node.setBin().

  4. Walk through all of the bins in order by CullBinManager.getBinSort().

  5. For each bin, render all of the geometry in order according to the bin type. Bin types BTFixed will sort according to the sort order number you specified with node.setBin(). Other bin types ignore the sort order number and sort in different ways.

There are two default DisplayRegions, with the following sort orders:

render 0
render2d 10

The default bins have the following sort orders:

background, fixed, 10
opaque, state_sorted, 20
transparent, back_to_front, 30
fixed, fixed, 40
unsorted, unsorted, 50
gui-popup, unsorted, 60

If you don’t specify a bin explicitly, the default is either “opaque” or “transparent”, according to whether the node has transparency enabled or not.

So, putting a big card in the “fixed” bin is usually sufficient to make it render on top of everything in the scene. But it might not be, if you are using the “unsorted” or “gui-popup” bin, or if you have created custom bins for yourself with new sort orders, or if you have things in another DisplayRegion (such as render2d).

The surest way to put a card on top of everything is to create a new DisplayRegion just for that card, and give that DisplayRegion a high sort index.