Hi,
I’m using a first-person camera and hide my mesh when in first-person by setting visibility = 0 to the mesh and its children. When that happens, the MirrorTexture no long shows the avatar. I want to be able to see my avatar in a mirror in first-person.
Is there any way around this? I know Three.js has the concept of layers and using multiple cameras to sort this out, but I haven’t found something similar in Babylon.js.
Here is the Playground link: Babylon.js Playground
Thank you very much!
Hello @AlbertoElias , how are you doing? Welcome to the Babylon community!
Yes, Babylon also has the concept of layers.
You can find more information here:
Layer Masks and Multi-Cam Textures | Babylon.js Documentation (babylonjs.com)
I’ve updated you example to make it work:
Mirror Example | Babylon.js Playground (babylonjs.com)
3 Likes
That’s perfect, and simpler than what I was understanding from the layer masks docs. Thank you so much!
Hey @srzerbetto, I’d be curious to understand why the Mirror shows the mesh if the docs say: It should also be noted that a mesh with a layerMask of 0 can never be seen by anyone.
Also, if I animate my avatar but it has a layerMask = 0
, the mirror doesn’t show the animated avatar, only its movements with an idle pose. I can’t find a solution to this.
Thanks again!
I found the answer here to keep running animations even when layerMask = 0
: layerMask stopping shadow? - #2 by Evgeni_Popov
1 Like
@srzerbetto hey, I’m now trying this out with the WebXRCamera, but the avatar is fully visible. Is this camera different in any way?
Can you share a repro @AlbertoElias ? it would greatly help @RaananW to troubleshoot
Ah, I found the issue. Creating a smaller reproduction helped find the problem. Sorry, I forgot to do so before asking and thanks for your time.
2 Likes