Weird lightmap texture error

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

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 :frowning:

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.

4.1 beta 22

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

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.

1 Like