Inverse normals parenting camera to gltf

I’m parenting a camera to a gltf mesh for a simple follow cam however I seem to be getting inverted normals viewing the mesh with the camera. Interestingly removing the skybox in a simple playground also seems to flip the normals back but you can’t seem to have both.

Am I doing anything obviously wrong?

Playground link: https://playground.babylonjs.com/#WGZLGJ#3479

Welcome aboard!

The problem is that when loading a gltf/glb file, we have to create a special node that will transform the right handed system of gltf to the left handed system of Babylon. That will invert the winding, but it is taken care at loading time for the meshes (the winding of materials are inverted). When you parent the camera to a gltf mesh, it will inherit the transformation that transforms from RHS to LHS, which in turn will be applied to the meshes, leading to a winding inversion.

The easiest way to handle that is to set the scene to RHS with scene.useRightHandedSystem = true;. This way, the special node created by the glTF loader has an identity matrix and everything is working as expected:

https://playground.babylonjs.com/#WGZLGJ#3488

1 Like

Ah thanks so much for the reply. That makes sense at last!