Problem with lightmap when using MeshBasicMaterial

Hi,

when I use lightmap with MeshBasicMaterial, it looks like lightmap override material color or texture, especially on pure black parts of lightmap (https://www.dropbox.com/s/dd4nq0x9tai4rn6/basic%20mat.PNG?dl=0).

When I use MeshLambertMaterial with ambient light, everything is OK (https://www.dropbox.com/s/wv85e8vosauvx3z/lambert%20mat.PNG?dl=0).

My lightmap: https://www.dropbox.com/s/mxz2r02r47uoavo/lightmap_tribune.png?dl=0

three.js r104

Has somebody any idea, what is wrong when I’m using basic material?

Thanks

Are you using an ambient light to illuminate the dark areas? At the very top of MeshBasicMaterial documentation it states, “This material is not affected by lights”. Maybe you’d like to set a brighter base .color instead?

I know about basic material and lights. I want to use that material with lightmap because of better performance. It doesn’t matter if I use basic material with only color or texture, lightmap will override that color or texture at least on that pure black parts (this isn’t happening with other materials with ambient lights).

If I understand lightmaps, white parts are fully lightened (original color) and black parts are fully darkened, but still have something from original color or texture. But with basic material this isn’t fulfilled

Related: https://github.com/mrdoob/three.js/issues/15548

MeshBasicMaterial has better performance than other material types because it does no physical lighting computation – similar (but not exactly?) to an “unlit” or “shadeless” material in other tools. So its support of light maps is a little confusing to me, but there is some prior discussion in the thread above to justify that. If it doesn’t seem to be working correctly you may want to file a bug.

1 Like

I just tried it out, and it looks like it performs a multiplication so any color gets multiplied to 0 on black. This is a hacky workaround, but you could probably fake “ambient lighting” by brightening your lightMap’s blacks to something lighter, like 33% grey.

@donmccurdy
Thanks for link. Merging texturemap and lightmap looks like a good idea to try.

@marquizzo
Yes, I know that lighter lightmap is a hacky solution, but I’d like to avoid that