Flipped normals when activating alpha blend in sandbox

I tested a model with glasish material and double layer in the sandbox. I was having some issues with my original model, so, for testing and understanding what happens, I created a simple torus, wrapped by an other tours. (made in blender.)

The mesh of the two-torus-model is flipping around some normals, when I activate alpha mode “combine” or “Pre-multiplied”. These are the only modes where I can control the level of alpha, so I wonder how to prevent the normals to flip.
Thank you for you advice or any hint on how to understand this and maybe what would be a good idea how to create a mesh with two layers of glas-like material. Debug mode set to “normals” gives me following screenshots which demonstrate the flipping. it is not happening when alpha-value is 1 but happens when alpha is lower than 1:

Find the glb-file here: https://virtueller-messestand.de/fileadmin/3dcontent/torus.glb

It is not flipping them, it just randomize triangles order due to the blend mode: Transparency and How Meshes Are Rendered - Babylon.js Documentation

Here you will need to either do a depth pre pass but won t see inside or you need to separate the draw calls by creating 2 meshes instead.

1 Like

Thank you four your quick and helpful answer. I will try out the 2-mesh-variant, because the view inside is mandatory for my use-case.
I was already reading the doc you linked, or lets say, I was too-fast-reading, and did not take the time to understand everything. I read it again. :slight_smile:

1 Like

I could get the result that I wanted (double-layer glass object). Having the mesh separated into two parts (inside and outside) did not solve the problem. I tried using the mesh visibility to control the alpha, while the material of both meshes is the single glass material. It helps to control the inner and outer of the glas, but the clue was to make sure to activate the “seperate culling pass” on the glass material, because only then the normals don’t get randomized.

I did not find any hint on the normals behavior (randomize?) in the documentation, though.
Thanks for your help, I keep sailing on line-of-sight.

1 Like

Please correct or extend my answer, in case I got something wrong. (That is the case, almost always :blush: )

It is actually not the normal being flipped but you see the opposite side of the torus which has opposite normals :slight_smile: as triangles sort is not an option without the separate culling pass you randomly render either the bottom inside part or the top outside one providing the reverse normal effect.