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…