[SOLVED] render artifacts with transparent faces?

when you have a tree which has many planes with transparent branch texture, no matterthe alpha type (alpha, dual, binary), the faces seem to partially disappear at some camera angles. What causes this? I hope you understood what i meant, this is so hard to describe.

Err… Did you make sure that the faces display both sides? It could be that you’re seeing the “back side” of the face…

This is a normal artifact of alpha transparency, and to a lesser extent, dual transparency. It is not a normal artifact of binary transparency, though, so if you’re seeing this kind of thing in binary transparency, I suspect you haven’t actually enabled binary transparency successfully.

Be sure to use an override to supercede any existing transparency settings on the node, e.g.:

node.setTransparency(TransparencyAttrib.MBinary, 1)


Happy to see you in the forums again.

You’re right, I didn’t and now it works.
A question though, if it’s not too complicated, could you maybe explain what causes this effect in the other modes? Maybe I could model my vegetation differently so this effect won’t happen or will be less noticeable in MDual

You can also use MMultisample transparency, though this requires creating a framebuffer with the multisample bits used for antialiasing. Use framebuffer-multisample. Some graphics cards support this better than others.

In general, “alpha” type transparency (really should be called “blending” transparency) works by blending the pixels of an object with whatever has already been written into the framebuffer, and then filling the Z-buffer with the distance of the new pixel. This works perfectly if everything that is behind the object has already been written into the framebuffer. If you go back and draw something else later that’s supposed to be behind the object, it doesn’t get drawn at all, because it gets clipped out by the Z-Buffer.

You can turn off the Z-Buffer, but then the new object completely replaces the blended pixel, and it’s as if the first object didn’t get drawn at all.

So, blending transparency requires all of the objects to be drawn in order from the farthest away to the nearest. Panda does this automatically, but it does this by sorting the objects based on the center of their bounding volumes, which only works when the objects are relatively far apart from each other. When two objects are nearly intersecting, or when it’s just different parts of a single object occluding each other, then this sorting stops working well, and you end up drawing some things in the wrong order, which causes the popping you see.

One approach to improve the problem is to subdivide your object into multiple smaller objects that can be sorted correctly. For instance, you could make each leaf of your tree be a separate object. This could, of course, get incredibly expensive if you have many leaves.

MDual is a compromise approach. It draws each transparent object in two passes. First, it draws only the fully opaque part of the object without any blending, and in the opaque bin, where ordering isn’t important. Then, when the transparent objects are being drawn back-to-front on top of the opaque objects, it draws the semi-transparent parts of the object. This is an improvement, especially for objects that are mostly alpha cutouts like leaves and such, because now when there is an ordering issue, it’s only the antialiased edge of the leaf that gets drawn incorrectly, and that’s a lot less obvious than the entire leaf. Of course, it’s more expensive than regular blending transparency because each object is drawn twice.


good explanation, simple enough fpr the manual.
Do you think this panda3d.org/forums/viewtopic … 1&start=30 (last 2 posts) are caused by this (hope not, will be hard to fix)?

Sure, it seems likely. With skyboxes, it’s usually easy to fix issues like this by setting an explicit rendering order: use bin controls to render all of your shells in the order from outermost to innermost.


thanks :slight_smile: