But it seems to me that no matter the settings, partial transparency only works "inside" the object itself, but not for objects behind it.
As you can see in the picture, the outer red circle (half transparent) is completely opaque for the sphere behind the box.
The doc mentions in the description of the class AlphaState that you could make a bottle with green glass and everything behind it would be tinted green.
That's what i'm trying to achieve (with texture of course). But how?
Are there additional settings required?
And what exactely do the various SB_, DB_ and TF_ values mean?
Although, only the Quad-cube has correct transparency in all 6 faces, while the Box-cube seems to have only 3 faces working correctely, depending on the direction from which the faces are looked at.
The problem occurs in every test case I made. Even in the unchanged TestRenderQueue.java, where each face of the transparent boxes is only rendered correctely from one side.
As seen on the screenshot, the right and back faces behind the front face are rendered as they should be; while the left, top and bottom faces seem to be ignored (?)
I guess there is only a thing missing or wrong set, as usual :). Maybe it has something to do with the normals of the box? Or with the correct combination of Source, Destination and Test values?
(Sadly, flipping normals and testing various src/db combinations didn't help me...)
I hope it is no actual engine bug in handling transparency :/
To put it in one sentence:
How do I get the Box-cube to be rendered the same way like the Quad-cube (from any direction, of course)?
Ahhh, you figured out a difficult problem. Because transparency is based on pixels being set in the same place before it, rendering order is important (back to front). Currently, the render queue handles that for whole objects, but when the object needs to be self transparent we run into the problem. The object (box in this case) is rendered in a specific order, one face at a time. It's rendered in this order no matter what direction you are facing it, because it doesn't have any sense of camera. So if one side is rendered first and it is in the front we have a problem.
We are looking into a solution. If anyone knows a quick fix, I'm all ears. Right now, it involves breaking up geometry by tris and queuing them up, which isn't a pleasant thought.
I was kind of hoping there was some OpenGL solution.
The fix is to render the object twice (as mentioned above,) culling the front facing polys the first pass and the back facing ones on the second pass. Fix tested and works, doing a bit of cleanup now. The RenderQueue will always render this way (giving more correct results) unless you specifically tell it not too by means of a flag on the RenderQueue.
Ok, the fix is in cvs. Please note that two pass transparency is enabled by default when you use the transparent renderqueue bucket. Also, any cullstate or zbufferstate you might have set on those objects will not be applied… we need to override them to make the transparent effect look right.
See TestRenderQueue for some fun. Hit Q to turn on the render queue and use R to toggle twopass rendering.