Question about PBR and Lightmap

Hey guys. i am trying to export gITF from blender and render it using threejs in browser.
I had some dump questions here(tried search on google but got no luck)

  1. according to blender gITF doc, gITF will combine texture and model together. does this mean all i need to load in threejs is the gITF model itself if i setup PBR texture correctly in blender?
  2. about lightmap, if 1 is correct, the only texture i need to load is the lightmap, right? and to make it easier, can i just bake lightmap into my diffuse map. so that i dont even need to load lightmaps. is it make senese?
  3. about lightmap. should i use a lightmap that baked all model’s shadow or should i bake many lightmaps for every single model in the scene?
    Thanks in addvance. please forgive me if there were any stupid question.
1 Like

Blender can export textures to glTF, but only if (1) the .blend is set up correctly and (2) glTF supports that type of texture. See this page for the full documentation on which material properties are supported in Blender’s glTF exporter, and how to configure them:

https://docs.blender.org/manual/en/2.90/addons/import_export/scene_gltf2.html#materials

I think there are two misunderstandings in your other questions. First, lightmaps are not supported by glTF, so you can’t export them and have them be used automatically as a lightmap by three.js. You could instead export other similar texture types, like baked lighting in a “base color” or “diffuse” texture, or baked shadow information in an “occlusion” texture.

Second, a lightmap is not generally used by itself. Baked lighting in a “diffuse” or “base color” map could be used alone, though. This depends on the effect you’re trying to get. More complicated materials will often use roughness, metalness, occlusion, and other textures… but if you don’t need those, don’t use them. :slight_smile:

about lightmap. should i use a lightmap that baked all model’s shadow or should i bake many lightmaps for every single model in the scene?

Up to you, but, fewer textures (and fewer materials) are generally a bit better for performance.

2 Likes