# createNormals fails if scene.useRightHandedSystem=true

**URL:** <https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240>\
**Category:** Bugs\
**Created:** [April 11, 2022, 4:25am UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240 "2022-04-11T04:25:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrlooi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrlooi/32/18406_2.png) [@mrlooi](https://forum.babylonjs.com/u/mrlooi)\
**Post date:** [April 11, 2022, 4:25am UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240/1 "2022-04-11T04:25:08Z")

</div>

By default (scene.useRightHandedSystem = false), createNormals will produce standard results

But if scene.useRightHandedSystem = true, createNormals doesn’t work properly

Here’s the [PG] “[https://www.babylonjs-playground.com/#LL5BIQ#569](https://www.babylonjs-playground.com/#LL5BIQ#569)”

Note: Don’t think this affects GLTF imports, but affects .babylon ones

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 11, 2022, 3:50pm UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240/2 "2022-04-11T15:50:37Z")

</div>

Hi! Will take a look at this.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 11, 2022, 9:15pm UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240/3 "2022-04-11T21:15:05Z")

</div>

Ok, I think I understand what’s going on now 🙂 The calculation for computeNormals already does take into account the scene orientation: [Babylon.js/mesh.vertexData.ts at master · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Meshes/mesh.vertexData.ts#L1742), so it properly computes the normals in right handed orientation. When we load a GLTF, its positions and indices are always in right handed orientation by definition, so to properly display it in Babylon, we add to it a **root** node that applies a transformation to go from right to left handedness.

But when we load a .babylon file, we assume we are loading coordinates in left-handed orientation, so no such transformation is applied. Then when calling createNormal with useRightHandedSystem = true, it’s calculating normals in a right-handed system using left-handed data, which won’t be correct. Unfortunately, there’s no way to always know when vertices are specified in left or right handed systems so we always have to be aware of it.

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [April 11, 2022, 10:29pm UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240/5 "2022-04-11T22:29:59Z")

</div>

Aah, so then to work around this, instead of calling createNormals() which uses scene.useRightHandedSystem, you can call ComputeNormals directly and pass false for the useRightHandedSystem option like on lines 40-42, if you know the model was loaded from .babylon and so uses left handed system… 🙂

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#LL5BIQ%23570)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![mrlooi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mrlooi/32/18406_2.png) [@mrlooi](https://forum.babylonjs.com/u/mrlooi)\
**Post date:** [April 12, 2022, 3:46am UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240/6 "2022-04-12T03:46:59Z")

</div>

This is super helpful, thank you both @carolhmj @Blake !

So…there’s no other way around this then other than to just ‘know’ it’s .babylon vs .gltf etc?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [April 12, 2022, 12:10pm UTC](https://forum.babylonjs.com/t/createnormals-fails-if-scene-userighthandedsystem-true/29240/7 "2022-04-12T12:10:21Z")

</div>

That’s right, .gltf always uses right-handed while .babylon uses left-handed. It’s still better than .obj because then there is no way to know without knowing which program generated it 🤣
