This is on 2D and should expect something similar on VR.

This is VR on a camera angle where it shows:


Basically transparency draw order is really important and as in VR some camera options are different the order your meshes are drawn is changing.
You should have a look at: https://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered#alpha-index
So here we can freely force the order as it always face the camera: https://www.babylonjs-playground.com/#M0EBV0#4
For the next time, please use our forum first https://forum.babylonjs.com/ as we keep github for bugs and planned features.
Hey, thanks for the documentation and the playground with the alpha index.
I still think there is something wrong here and that overriding the rendering with the alpha indexes is not the best solution and it is not easy to apply everywhere. On the playground example (https://www.babylonjs-playground.com/#M0EBV0#2), the distance for the box and 2 planes from the camera is very clear and the order is correct at every moment. However the rendering doesn't seem to be working as expected. On half of the dome, the menu renders correctly and on the other half, it doesn't.
For us (Sharepoint Spaces team), this was a breaking change when we moved from 4.2.0-alpha.2 to 4.2.0-alpha.20. I really do think that something is failing here on rendering based on the distance to the camera or that there are other things that need to be considered that we don't know of. Forcing the alpha index is not the most scalable solution for us.
Oh, is that a regression from 4.2.0-alpha.2 to 4.2.0-alpha.20 ? and could we move the discussion to the forum so that we ll reopen the ticket with all the infos at hand ?
Addding @RaananW so that he can also have a look.
Looking into that.
Can i ask about the last line in the box positioning function? The lookAt seems to force the box to face in the other direction (which is the problem you are facing in VR, i believe). Setting the box to look at the camera makes it work in XR:
Thanks @RaananW I am really wondering about the regression though, any explanation about the behavior change ?
I did change the way the position is updated (mainly to support right handed systems), but it should have produced the same results. I'll find the exact version in which it started tomorrow and will be able to pinpoint the reason.
Hey, I just opened a discussion on the forum:
https://forum.babylonjs.com/t/vr-only-the-rendering-order-on-alpha-meshes-is-seems-to-be-altered-by-something-other-than-camera-distance/11981
I looked into the last playground on VR and the issue is still there. The problem is just on the opposite dome side. The lookAt at the end is to align text on the box to display correctly
Should be fixed by the previous PR and will be part of the next nightly
Thanks for the help. We can take the update on Moday!
I am releasing 4.2.0-alpha.22 as we speak for this and Nathan fix as well ;-)
4.2.0-alpha.22 is up :-)
Most helpful comment
Hey, I just opened a discussion on the forum:
https://forum.babylonjs.com/t/vr-only-the-rendering-order-on-alpha-meshes-is-seems-to-be-altered-by-something-other-than-camera-distance/11981
I looked into the last playground on VR and the issue is still there. The problem is just on the opposite dome side. The lookAt at the end is to align text on the box to display correctly