# Weird lightmap texture error

**URL:** <https://forum.babylonjs.com/t/weird-lightmap-texture-error/8253>\
**Category:** Bugs\
**Created:** [January 27, 2020, 12:52am UTC](https://forum.babylonjs.com/t/weird-lightmap-texture-error/8253 "2020-01-27T00:52:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [January 27, 2020, 12:52am UTC](https://forum.babylonjs.com/t/weird-lightmap-texture-error/8253/1 "2020-01-27T00:52:03Z")

</div>

Hey guys… i got a weird shader error all of the sudden when there is EITHER **No light at all** (Using just baked lighting from lightmapTexture) or if the light.lightmapMode === 0 (DEFAULT)… it gets a shader error: lightmapColor is undeclared indentifier

 ![Screen Shot 2020-01-26 at 2.43.26 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/8/86f06d4a1c354b95b525836e6a609ebc425f6be9.png)

Its so hard to RE-CREATE my EXACT scene in the playground. That will take sooo long to do… that is a project in itself.

I was hoping WHOEVER has been working on the shader code lately might have some insight as to why using **material.lightmapTexture** and you **dont** have a light with its **light.lightmapMode === SPECULAR or SHADOW** is now causes a shader error.

I dont know if its just my projects or what… Because how could **NO ONE ELSE** notice that using lightmapTextures with DEFAULT lightmapMode is causing shader errors ☹

---

<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:** [January 27, 2020, 9:12am UTC](https://forum.babylonjs.com/t/weird-lightmap-texture-error/8253/2 "2020-01-27T09:12:54Z")

</div>

Which Babylon version are you using?

Looking at the source code in the current 4.1 beta, I can’t see why this error would pop up.

---

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [January 27, 2020, 10:34am UTC](https://forum.babylonjs.com/t/weird-lightmap-texture-error/8253/3 "2020-01-27T10:34:40Z")

</div>

4.1 beta 22

---

<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:** [January 27, 2020, 10:53am UTC](https://forum.babylonjs.com/t/weird-lightmap-texture-error/8253/4 "2020-01-27T10:53:37Z")

</div>

That’s strange, because I looked for all occurrences of `lightmapColor` and they are always enclosed inside some `#if defined(LIGHTMAP)` and the very first `#ifdef LIGHTMAP` does declare the `lightmapColor` variable.

[https://playground.babylonjs.com/#RN7HN3](https://playground.babylonjs.com/#RN7HN3)

There’s no light, the PBR material has an albedo + lightmap texture and it does work.

If you set `noLight = false`, a directional light is created with `.lightmapMode = 0` and it still works.

It would help if you could copy the fragment shader with the error:

- locate the `_processCompilationErrors` function (in the `Effect` class)
- add `console.log(this._fragmentSourceCode)` at the start

You will need to use the “.max.js” bundle to be able to perform this change.
