Hi, I am struggling trying to mask a mesh with a plane that is on a different layerMask.
I’ve started here, where both meshes are on the same layerMask and it works nicely.
From here, I’d like to put that masking plane on a different layerMask, rendered by a second camera which doesn’t have any rotation inputs. For some reason the original plane goes missing
I found a very interesting thread here, there were a lot of interesting ideas, viewport, adding scenes etc but I’d like to keep it within the layerMask and rendering Groups if possible.
Any help would be much appreciated
I just changed
layerMask = 1; which display your second plane. https://playground.babylonjs.com/#QMWDSY#1
Thanks but this is not working, it is now displaying 4 planes where 2 are still and 2 are moving.
What I meant is that 1 plane (the small black one) can rotate with camera 1 but it is masked by a second plane (the wider grey one) which is on a different layerMask, same as camera 2 which is not moving.
you mean to rotate just the black plane? like this? https://playground.babylonjs.com/#QMWDSY#3
I just assigned layer mask to first camera here
Thank you so much @Dshah_H
Assigning the layer mask to the first camera is what I was missing. Many thanks again.
EDIT: You tricked me, this is not working either, the grey plane is not masking the black square, it just looks like it does
@wannax ah not sure about that then, maybe one of gurus here will be able to help you in that, for masking I usually go with simple tricks rather than layerMask, like here https://playground.babylonjs.com/#QMWDSY#4
Yep, with 1 camera only and no layerMask I was able to make it work as well, the problem comes when there are 2 cameras and the masking object is on a different layerMask
I found a workaround as it was impossible to make it work with layerMasks and two different cameras in case anyone will need something similar to this.
The idea is to only use 1 camera but then parent the masking plane to the camera, that way the plane won’t seem to be moving whereas the scene will still be moving inside the masking area.
Although it is not really the solution to my initial question I will mark it as the solution hoping this might help someone in future