About lightmaps and how export/use them from Unity into three.js

Hi everyone!
I am building a 3D scene in Unity and trying to export that in three.js. In the scene there are a lot of lights sources. I read that to save computational resources it is possible to generate a lightmap which stores lighting data like shadows in a texture for static objects. Now I am not sure I completely understand how this works in practice. These are my doubts, hopefully someone can shed some light:

  • Is the lightmap intended to completely replace the light sources (no need to add Lights in the scene)?
  • Or it is used only to provide shadows informations, thus it is possible to avoid casting/receiving shadows dynamically in the scene and save resources?
  • There is one lightmap for the whole scene or should be one lightmap per object? In other words, how should I apply lightmaps in a three.js scene?

Taking the case of Unity, if I use “Generate Lighting” in the Lighting panel I see that Unity creates several images with lighting informations like:

  • Lightmap-0_comp_dir.png
  • Lightmap-0_comp_dir.png.meta
  • Lightmap-0_comp_dir.exr
  • Lightmap-0_comp_dir.exr.meta
  • Lightmap-1_comp_dir.png
  • Lightmap-1_comp_dir.png.meta
  • Lightmap-1_comp_dir.exr
  • Lightmap-1_comp_dir.exr.meta
  • […]

Is it possible to use these files as lightmaps into a three.js scene? If yes, how should it be done?

1 Like

hi, did you resolve this lightmap export problem? I am looking for solution on this problem too…

Hello guys, I have the same problem.

I did the lightmap from Unity3D, and the image of that lightmap is:

I know that a second set of UVs is needed in my models if I want to apply the lightmap, but, how can I export from the Unity project?


In 3ds max I’ am exporting to OBJ format scene with first default UV.
And export to OBJ format scene with second lightmaping UV. And into three.js load first scene. And after it second scene with adding UV to mesh from first scene. May be unity can export two UV’s

Hello, thank you very much for your answer!

Can you explain how are you selecting which UV are the ones that you want to the exportation please? Which are the steps to do It?

Thank you! I hope that this can solve my problems, there’s no much info in internet about the exportation of a lightmap from a engine and the importation in three js.

I am stuck in same problem. LightMap is exported from Unity But I can not found second UV.
when i apply to default UV it will be taken as texture for all meshes

How can I solve this?