I’m trying to create a particular scene for which I’m running to issues. Let me describe what I have in mind and show you the issue.
I am trying to render multiple transparent objects that are at approximately similar spatial locations. This is for a biomedical application for brain visualization. I basically need to generate multiple surfaces at similar locations that are ALL transparent.
Now let me show you the problem in a few figures.
Here, you can see an example visualization in which two different groups of meshes (pink and grey) are being rendered as opaque:
As you can see this renders perfectly. Now this is how it looks if only one of the mesh groups were transparent:
So far it all looks perfect. Pay attention to how the opaque surface underneath is rendered as if it is in a glass container, but yet totally visible.
Now, getting to the issue, this is what happens if both surfaces were rendered as transparent:
As you can see, suddenly the order of visualization gets messy. Some surfaces that are at the back, get rendered first, and surfaces in the front are occluded by them. I imagine this is because panda3d simply checks the boundary box of each surface mesh and decides the order of rendering. (The order of rendering is not decided at the level of individual faces, but at the level of surfaces.
I should mention that in Panda3D, I reorder each surface’s triangular meshes according to their proximity to the camera and that’s how a single transparent surface looks ok. Now I’m wondering how I may solve this issue.
Obviously, one manual laboursome solution would be to first combine all meshes together into a single surface mesh and then reorder all triangles myself. But I am wondering if there is a way to have Panda3D appropriately handle multiple transparent objects correctly (say a glass inside another glass)? To somehow render faces one by one and orderly?