as part ot the OpenVgal project (more info in the demos/project section) I have been optimizing performance vs visual aspect. Artworks are shown on a virtual gallery. The best tradeoff so far is to bake everything into a gltf, except the artwork images which are loaded at runtime as they are separate objects. That solves the lightening limitations of babylon, but could be pushed even further using lighmaps as that may reduce the amount of baked stuff.
I saw the post from @DRLeria explaining his lightmap exports from 3DS to babylon. Doing it object by object is a pain (much uglier in blender). Blender has the option to “lighmap pack” several objects into a single additional UV map. Is there any option to use that packed lightmap in bablylon or would it be possible to approach it in the future?
you can set the uv layout index of any texture on a material in babylon . Nothing stops you from having many materials all use a same lightmap texture. There is no means to define lightmaps to the materials and the uv index in GLTF/GLB format. You will have to write some code to import the lightmap texture and assign it to the material/s and also set if it is a shadow or lightmap and also the uv index to use.
Thanks so much. Yes, I was counting on the limitation from GLTF. I will prepare some proof of concept to test it.
In your case the workflow could be:
- Optimize the meshes to the maximum.
- Limit the use of materials for the base model, for example using Texture Atlas and configuring the UVMap of your model with the zones of the Atlas, in this way you can optimize the use of materials and facilitate the assignment of Lightmaps.
- Finally, simply with a few lines of code you assign the lightmaps to your model.
Hope it helps
Thanks for your hints and the existing code by @DRLeria. I have a proof of concept in the playground. It works great:
I will create a separate tutorial on the whole process: create the lightmap in blender, save it and use it in babylon. Lightmap baking is powerful yet is very under represented in the “tutorial scene”.