# ThinInstances lighting behaviour seems off

**URL:** <https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121>\
**Category:** Questions\
**Created:** [October 24, 2025, 1:11pm UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121 "2025-10-24T13:11:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tarks/32/48474_2.png) [@Tarks](https://forum.babylonjs.com/u/Tarks)\
**Post date:** [October 24, 2025, 1:11pm UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121/1 "2025-10-24T13:11:07Z")

</div>

Not sure if it’s the lighting, or the materials or what, but everything’s darker

**Without ThinInstances**

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/9/b95bb8a869c2c23b801d9913d8a214d2353061d4.jpeg)

**With ThinInstances**

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/9/29e9dca38904c77d2bc1fad84ce5766e49819493.png)

I’ve tried exporting a serialized version of the scene to help

**Playgrounds**

**Without ThinInstances**

> **[Babylon.js Playground](https://playground.babylonjs.com/#P3PB9N%232)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

**With ThinInstances**

> **[Babylon.js Playground](https://playground.babylonjs.com/#S2FTTA)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [October 24, 2025, 3:25pm UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121/2 "2025-10-24T15:25:26Z")

</div>

cc @Evgeni_Popov

---

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [October 25, 2025, 12:50am UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121/3 "2025-10-25T00:50:30Z")

</div>

Is this better now?

```
    const mesh = nS.getMeshById('Clone of Hill_merged') as BABYLON.Mesh;
    mesh.sideOrientation = 1;

```

> **[Babylon.js Playground](https://playground.babylonjs.com/#LEDJEG)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Tarks](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tarks/32/48474_2.png) [@Tarks](https://forum.babylonjs.com/u/Tarks)\
**Post date:** [October 25, 2025, 11:21am UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121/4 "2025-10-25T11:21:26Z")

</div>

Yes, thankyou ! What have I not understood?

This is the part of my code that loads meshes, I’m calling `mergeMeshes` on all objects set to be thinInstances, but not sure how causing winding issues.

```auto
const meshContainer = meshAssetContainer.instantiateModelsToScene();
      let rootMesh = meshContainer.rootNodes[0] as Mesh;
      rootMesh.rotation = babylon.Vector3.Zero();

      // Babylon applies a scaling of x:1,y:1, **z:-1** to all meshes loaded.
      // I assume that's a hack to get meshes to align with its rendering orientation
      rootMesh.bakeCurrentTransformIntoVertices();

      rootMesh.metadata = {};

      if (shouldCreateThinInstance) {
        if (!this.isInsideNullEngine()) {
          const allmeshes = rootMesh.getChildMeshes() as Mesh[];
          const mergedMesh = Mesh.MergeMeshes(allmeshes, true, true, undefined, false, true);

          rootMesh = mergedMesh!;
          rootMesh.alwaysSelectAsActiveMesh = true;
          rootMesh.thinInstanceEnablePicking = true;

          const instanceId = rootMesh.thinInstanceAddSelf();

          rootMesh.thinInstanceSetMatrixAt(
            instanceId,
            babylon.Matrix.Translation(transformComponent.position.x, transformComponent.position.y, transformComponent.position.z)
          );

          // Todo : this would be replicated if we did this on the server...
          meshComponent.thinInstanceId = instanceId;

          this.assetLoader.addAssetCacheItem(thinInstanceCacheId, rootMesh);
          return { createType: "thinInstance", mesh: rootMesh, thinInstanceId: instanceId, thinInstanceCacheIdForVisual: thinInstanceCacheId };
        } else {
          return { createType: "nullEngineResult" };
          // On the server we get
          // MeshHandler.ts:108 BJS - [16:22:45]: Thin Instances are not supported on this device as Instanced Array extension not supported
          // Becuase it's using the null engine
        }
      }

      return { createType: "mesh", mesh: rootMesh };
    }

```

If I apply the sideOrientation = 1 to everything I get the ‘problem’ meshes working and the meshes that were fine misbehaving.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/9/d9203b7935d6220f4b685c64837c304c69d0d32a.jpeg)

Checking the normals in blender implies they’re the ‘right’ way round too

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/3/63f1d32138506fb2e9fdaf148f632bf7a141e284.jpeg)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 25, 2025, 11:54am UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121/5 "2025-10-25T11:54:28Z")

</div>

I think this post should help you (but the entire thread is very informative):

> [@Automatically Convert Instances to Thin Instances?](https://forum.babylonjs.com/t/automatically-convert-instances-to-thin-instances/44236/13):
>
> Here’s a working PG: The main problem was that the glTF loader sets the mesh.overrideMaterialSideOrientation property, which takes precedence over the material.sideOrientation property, meaning the new material side orientation was not taken into account.

---

<div class="post-metadata">

**Author:** ![Sucher](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Sucher](https://forum.babylonjs.com/u/Sucher)\
**Post date:** [November 7, 2025, 6:57am UTC](https://forum.babylonjs.com/t/thininstances-lighting-behaviour-seems-off/61121/6 "2025-11-07T06:57:19Z")

</div>

Our objective is to develop a dataset and approach addressing the autonomous or assisted harvesting[,](https://seminolecountyclerkofcourt.click/) loading and measuring of logs, ie cut stems and branches.
