Binning issues

Hey everyone,

I am running into problems creating a particular transparency schema for fog effects. I have transparent fog png’s wrapped around large cylinders, set to rotate around the guest in a VR world. The render tree looks something like this:

I. render
A. NodePath actorLighting
i. actor #1
ii. actor #2

B. NodePath ambientEffectLighting
i. skydome
ii. treeline
iii. horizon
iv. fog
C. scenery #1
D. scenery #2

So, I am lighting each of the nodes above differently for my world, so this render hierarchy is important to maintain. The problem I am running into is when trying to setBin on the fog, which is supposed to show the scenery and the actors to some degree. It is blacking them out, unfortunately. Currently my binning scheme is as follows, with the parenthesized terms being the bin string and the draw order respectively

ambientEffectLighting(“render”, -100)
actorLighting(“render”, -90)
scenery #1-#… ("render, -45)
skydome(“ambient”, -100)
horizon("ambient, -80)
fog1(“ambient”, -60)
fog2(“ambient”, -40)

Currently both the scenery and the actors are being blacked out by the fog texture. I was wondering if anyone could tell me what I am doing wrong here.

Cheers,
Lucas

You are referring to bins named ‘render’ and ‘ambient’, but neither of these is the name of a bin that is defined by default in Panda. Have you already defined these bins yourself? If you have, either in your Config.prc file or via a call to CullBinManager.addBin(), have you defined them as “Fixed” sorted bins? If not, then the draw order parameter you pass to each node is not used. Also, what is the sort order of the two bins with respect to each other–which one of the two will be drawn first? This is determined by the “sort” parameter of each bin; the lower-sorted bin will be drawn first.

Do you see an error message like this at startup:

:pgraph(warning): No bin named ambient; creating default bin.
:pgraph(warning): No bin named render; creating default bin.

If so, then you have not defined these bins, and you are getting a default bin with a sort value of zero and a sort type of “Unsorted”, and the relative sorting of the two bins to each other (and of nodes within each bin) will be random.

In any event, you will need to bin your fog so that it is drawn after anything that is behind it, but before anything that is in front of it. It sounds like you have put everything that is intended to be in the background in the “ambient” bin, and everything that is in the foreground in the “render” bin. Thus, you need your “ambient” bin to be drawn first.

I suggest you put the following lines in your Config.prc file:

cull-bin ambient 10 fixed
cull-bin render 15 fixed

See this document for more information on explicitly controlling the render order like this: howto.control_render_order.txt

David