Plane, depth and rendering order

Hello everyone, hope you are all doing great. :hugs:
Congrats on the launch of BJS 6.0, crazy to see all the new cool stuff you added! :stars:

I have a question concerning rendering orders using planes. I know from this documentation content that it is advised to avoid using big planes which makes it difficult to determine the right depth sorting.
Unfortunately, I must use big planes for my use case and I encounter this issue. Is there any way to solve this issue? I tried many things including all the things from the above link but didn’t find anything working.

Here is a playground where the text appears/disappears while moving the camera in order to test a potential solution:
I used shaders in this playground to be closer to my use case.

Thanks a lot for your help! :pray:

I’m not sure it’s possible. Maybe @Evgeni_Popov knows a way?

You can use renderingGroupId, but you have to add all your other meshes to renderinggroup with id 1.
Or maybe some hack to force the ground renders first of all transparent items.
And it only works when users are banned to go “under” the ground.

Playing with renderingGroupId or alphaIndex does solve the problem in the playground:

I have many planes in my use case so not sure it will work but I come back to you :muscle:

Using the alphaIndex was indeed the right thing to do !

Thanks a lot, folks :wink:

1 Like