Is there a way to apply the same transparency to a mesh even if several faces of the mesh overlap in front of the camera.
In the image, the red boxes have a different transparency, I want the transparency to be the same regardless of the rotation/position of the mesh
i tested with material alpha mode.
BABYLON.Engine.ALPHA_COMBINE,
BABYLON.Engine.ALPHA_ADD,
BABYLON.Engine.ALPHA_SUBTRACT,
BABYLON.Engine.ALPHA_MULTIPLY,
BABYLON.Engine.ALPHA_MAXIMIZED
Cedric
March 25, 2024, 8:22am
2
I would try with a prepass renderer
https://doc.babylonjs.com/typedoc/classes/BABYLON.PrePassRenderer
so only the closest pixels to the camera will be visible. No overdraw.
1 Like
mawa
March 25, 2024, 8:33am
3
Cedric:
a prepass renderer
May I ask you if this technique also doubles the drawcalls (like a depth renderer)? What’s the impact on perf?… Just being curious here.
Cedric
March 25, 2024, 8:38am
4
it depends on the number of drawcalls, and the target device. Before checking the perf, make sure it’s valid for fixing the issue. if it’s not, then no need to worry about the perf
1 Like
I would use the stencil and configure it to not write where the mesh has already written:
3 Likes
I wonder if setting the mesh to use depthPrepass could also solve it
sphere.material.needDepthPrePass = true;
2 Likes
mawa
March 25, 2024, 4:51pm
7
Yes, that can work. Funny that I didn’t think of it as I’m using this a lot in my scene.