Changing lightmap of gltf Model


I’m wondering how can I change the lightmap at runtime when I add for example furniture to my model?

Best Regards,


You could use the functions like scene.getMaterialById or getMaterialByName to find the materials to modify after loading the model.

Then simply use material.lightmapTexture to assign a lightmap to the material

1 Like

But to replace every lightmap of every mesh would be very painful because there are a lot, is there no other way?

If lightmaps changing is painful you may use realtime shadow casting instead of lightmaps.
Or maybe find other ways to create illusions which you need, with no lightmaps and no shadows (surely it depends on your specific application).