Mask and RenderingGroup don't work, rectangle and cube visible by two cameras not only one

line : 371 and 377. Thanks <3 / PS : click on corner right for look code

RenderingGroupId is not for camera visibility, it’s used to change the order of objects when they are rendered. As for the layerMask, to determine if a mesh is rendered by a camera, the operation done is a bitwise AND ( Bitwise AND (&) - JavaScript | MDN (, (mesh.layerMask & this.activeCamera.layerMask) !== 0. Since your cube had layer mask of 3, which is 11 in binary, the bitwise AND with both cameras was returning 1:

  • 11 & 01 = 01, 01 != 0
  • 11 & 11 = 11, 11 != 0

As for the AdvancedDynamicTexture, the correct way of setting the layerMask there is advancedTexture.layer.layerMask = 1;.

EDIT: I think the docs can be clearer in what operation is being performed to determine visibility so I expanded upon it a bit Update layerMask docs by carolhmj · Pull Request #753 · BabylonJS/Documentation (


This is always good for such a complex topic. Just remember that we also added with the help and expertise of @Evgeni_Popov

May be a link or a bit of reorganizing the content? FYI only,

1 Like

Oh it’s a great idea to add at least as a link! Thanks mawa :smiley:


oh some much answers thanks, i read this :DDD yo mawa my savior haha