I have some issues with transparency in my scene. I have a set of meshes that all have to be transparent. If the camera is facing the meshes in a certain direction, the faces of the meshes that are further away from the camera (behind the closest mesh) will suddenly stop rendering. See screenshots: (Partially) correct rendering:
I sadly can’t duplicate my code in playground due to company policy regarding the model I’m using, but I tried to replicate the issue as best as I can with simple boxes here: https://playground.babylonjs.com/#KHQENE#69
If you try to pan around a bit you can see that some faces disappear behind boxes that is supposed to be transparent. Any thoughts on how I can solve this?
Here’s a snippet of how I import and set up the materials for the model in my scene:
@sebavan thanks for the reply! It appears that by setting scene.useOrderIndependentTransparency = true I am getting closer to good transparency, but there is still some faces that are not acting truly transparent. There is a yellow mesh behind the green meshes that is circled with red in this picture, and as you can see it completely hides the mesh. The green meshes (and the yellow) are completely transparent from the other angle. It does not help to change rendering order.
I’m afraid to say this solution is not satisfying as of just now. I however encourage improvements for this (but I won’t use it until then).
I am like you. I have a complex scene with lots of transparency/alpha blending and despite from (I believe) strictly following the rules stated in the doc (no intersection between meshes, backFaceCulling, etc…) I still experience issues (which I will likely post in this forum shortly).
The only way aside of OIT I found is to set the alphaIndex. But then, on a very complex design with lots of levels of transparency and a camera that can look at them from all angles, it’s a nightmare (not to say impossible to set up).
As for your crude PG example, it would work like this I suppose:
But honestly, I have no faen clue how I can make this work in my scene…
The story continues…
Edit: Just checking back, even this does not work. When passing the camera over two edges with alpha, you can see the alpha changing So far, I did not manage to get an understandable and sustainable answer for this issue (but may be it’s just my small brain… or may be there is something to be improved around this?)
Maybe you need more passes in the depth peeling process used for OIT :
scene.useOrderIndependentTransparency = true;
scene.depthPeelingRenderer.passCount = 15; // might be too big, try to find the right value by trial and error
Sadly this made no visual changes to my scene, no matter what passCount value I set. Is there any other flags that is mandatory to set for depthPeelingRenderer to go into effect?