# Shader fails to compile due to unresolved identifier \`areaLightsLTC1Sampler\`

**URL:** <https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955>\
**Category:** Bugs\
**Tags:** lighting, shader\
**Created:** [December 29, 2025, 8:48am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955 "2025-12-29T08:48:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mysticfall](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mysticfall/32/23991_2.png) [@mysticfall](https://forum.babylonjs.com/u/mysticfall)\
**Post date:** [December 29, 2025, 8:48am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/1 "2025-12-29T08:48:40Z")

</div>

In my application, users can dynamically add objects, including area lights. And the only selected light is enabled at any given time to avoid performance issues.

However, I found that when the user selects an area light after selecting a point light, a shader error occurs, which makes some of the materials invisible:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/5/a58b1ffa480c5c9fd81541d36a718bc0927b16c9.jpeg)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/8/78ab0c03581662f0052ae955d841c04147357127.png)

The console log reveals that the immediate cause of the problem might be an unresolved identifier, like `areaLightsLTC1Sampler`as shown below:

```auto
Error: FRAGMENT SHADER ERROR: 0:1166: 'areaLightsLTC1Sampler' : undeclared identifier
ERROR: 0:1166: 'areaLightsLTC2Sampler' : undeclared identifier
ERROR: 0:1166: 'computeAreaPreLightingInfo' : no matching overloaded function found
ERROR: 0:1166: 'assign' : cannot convert from 'const mediump float' to 'structure 'preLightingInfo' (symbol id 3295)'
ERROR: 0:1172: 'computeAreaDiffuseLighting' : no matching overloaded function found
ERROR: 0:1172: '=' : dimension mismatch
ERROR: 0:1172: 'assign' : cannot convert from 'const mediump float' to 'highp 3-component vector of float'
ERROR: 0:1173: 'computeAreaSpecularLighting' : no matching overloaded function found
ERROR: 0:1173: '=' : dimension mismatch
ERROR: 0:1173: 'assign' : cannot convert from 'const mediump float' to 'highp 3-component vector of float'

```

And the relevant shader fragment looks as follows:

```auto
preInfo=computeAreaPreLightingInfo(areaLightsLTC1Sampler,areaLightsLTC2Sampler,viewDirectionW,normalW,vPositionW,light1.vLightData,light1.vLightWidth.xyz,light1.vLightHeight.xyz,roughness);

```

From what I’ve found, the problem seems almost identical to the one that was resolved by a merged PR [#16577](https://github.com/BabylonJS/Babylon.js/pull/16577),

Could it be fixed by a similar measure if they are the same kind of problem?

Thanks in advance!

---

<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:** [December 29, 2025, 10:35am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/2 "2025-12-29T10:35:23Z")

</div>

Is there any chance you could reproduce the problem in the Playground? Without reproduction, it will unfortunately be difficult to find the reason why it crashes.

Shot in the dark =\> you can try adding this line of code at the beginning of your program:

```javascript
BABYLON.ShaderStore.IncludesShadersStore["lightFragment"] = BABYLON.ShaderStore.IncludesShadersStore["lightFragment"].replaceAll("defined(AREALIGHTSUPPORTED)", "defined(AREALIGHTSUPPORTED) && defined(AREALIGHTUSED)");

```

If it works, I will create a PR with the change.

---

<div class="post-metadata">

**Author:** ![mysticfall](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mysticfall/32/23991_2.png) [@mysticfall](https://forum.babylonjs.com/u/mysticfall)\
**Post date:** [December 29, 2025, 11:32am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/3 "2025-12-29T11:32:44Z")

</div>

I tested again after applying the change, and got a different shader error:

```auto
Error: FRAGMENT SHADER ERROR: 0:1138: 'computeAreaDiffuseLighting' : no matching overloaded function found
ERROR: 0:1138: '=' : dimension mismatch
ERROR: 0:1138: 'assign' : cannot convert from 'const mediump float' to 'highp 3-component vector of float'
ERROR: 0:1139: 'computeAreaSpecularLighting' : no matching overloaded function found
ERROR: 0:1139: '=' : dimension mismatch
ERROR: 0:1139: 'assign' : cannot convert from 'const mediump float' to 'highp 3-component vector of float'

```

And the offending line was:

```auto
info.diffuse=computeAreaDiffuseLighting(preInfo,diffuse1.rgb);

```

I’m sorry I can’t provide more useful information about the issue. I can export the scene if it helps, but I’m afraid I won’t be able to make a simple, reproducible test case at the moment.

Thanks much for trying to help. I just hope that the changed error message means you’re right on track to find the root cause.

---

<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:** [December 29, 2025, 11:39am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/4 "2025-12-29T11:39:22Z")

</div>

Ok, so try this fix instead of the previous one:

```auto
BABYLON.ShaderStore.IncludesShadersStore["lightFragment"] = BABYLON.ShaderStore.IncludesShadersStore["lightFragment"].replaceAll("defined(AREALIGHT{X})", "defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)");

```

---

<div class="post-metadata">

**Author:** ![mysticfall](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mysticfall/32/23991_2.png) [@mysticfall](https://forum.babylonjs.com/u/mysticfall)\
**Post date:** [December 29, 2025, 11:43am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/5 "2025-12-29T11:43:58Z")

</div>

The error message changed again. It’s about specular light, this time:

```auto
Error: FRAGMENT SHADER ERROR: 0:1139: 'computeAreaSpecularLighting' : no matching overloaded function found
ERROR: 0:1139: '=' : dimension mismatch
ERROR: 0:1139: 'assign' : cannot convert from 'const mediump float' to 'highp 3-component vector of float'

```

The offending line:

```auto
info.specular=computeAreaSpecularLighting(preInfo,light1.vLightSpecular.rgb,clearcoatOut.specularEnvironmentR0,reflectivityOut.colorReflectanceF90);

```

---

<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:** [December 29, 2025, 2:04pm UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/6 "2025-12-29T14:04:20Z")

</div>

Indeed, this one has a different syntax!

Try:

```auto
BABYLON.ShaderStore.IncludesShadersStore["lightFragment"] = BABYLON.ShaderStore.IncludesShadersStore["lightFragment"].replaceAll("defined(AREALIGHT{X})", "defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)").replaceAll("#if AREALIGHT{X}", "#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)");

```

---

<div class="post-metadata">

**Author:** ![mysticfall](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mysticfall/32/23991_2.png) [@mysticfall](https://forum.babylonjs.com/u/mysticfall)\
**Post date:** [December 30, 2025, 1:07am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/7 "2025-12-30T01:07:12Z")

</div>

That finally did it! I can confirm that the line fixed my issue.

I’m glad that you not only fixed my issue promptly despite limited information, but also provided a workaround I can use until the fix lands in a new version.

Thanks very much for the help!

---

<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:** [December 30, 2025, 9:04am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/8 "2025-12-30T09:04:23Z")

</div>

I’m glad it worked out for you!

cc @srzerbetto to create the PR, as I’m on vacation now.

The fix I made is to apply these changes in `lightFragment.fx`, but you should check if it looks ok for you:

```auto
replaceAll("defined(AREALIGHT{X})", "defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)")
replaceAll("#if AREALIGHT{X}", "#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)");

```

---

<div class="post-metadata">

**Author:** ![srzerbetto](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/srzerbetto/32/20941_2.png) [@srzerbetto](https://forum.babylonjs.com/u/srzerbetto)\
**Post date:** [December 30, 2025, 4:17pm UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/9 "2025-12-30T16:17:07Z")

</div>

@mysticfall, we have merged a PR that should fix this issue. I will update here when we have a release published with the fix. Thanks for finding the bug!

---

<div class="post-metadata">

**Author:** ![mysticfall](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mysticfall/32/23991_2.png) [@mysticfall](https://forum.babylonjs.com/u/mysticfall)\
**Post date:** [December 31, 2025, 3:46am UTC](https://forum.babylonjs.com/t/shader-fails-to-compile-due-to-unresolved-identifier-arealightsltc1sampler/61955/10 "2025-12-31T03:46:27Z")

</div>

Thanks much! And happy New Year. 🙂
