How to add a shadowmap to a GLB

I’m hoping someone here can help me, since I’m a 3D Artist with no coding knowledge whatsoever (but willing to learn). I’m trying to bake lighting for a .glb file with the help of sandbox.babylonjs.

I have the following problem: I have a bought 3D model, which is already uv mapped and textured, but with overlapping UVs. Now I want to do some light baking, without having to re UV and retexture the entire model. Because of the overlapping UVs on ‘UV0’, I created an new UV set ‘UV1’, where I want to put my rendered shadowmap.
I’ve imported my .glb file into Sandbox.js and added my shadowmap to the ‘Lightmap’ channel, using UV1. In the Sandbox viewer, everything looks as it should. But after exporting the file by clicking on the ‘Export to GLB’ the shadowmap is missing, only the Albedo texture is visible.

So my question is: Is it possible to export a .glb file with a functioning shadowmap? I would also be very thankful if anyone has any other solutions to my problem.

Welcome aboard!

Unfortunately, glb does not support lightmapping. I think there was some talk about adding an extension, but I don’t think it came to fruition (yet?).

This thread could help:

3 Likes

Shortly, you’ll need to additionally import lightmap texture for each GLB (or GLB part) and assign it as you did in sandbox.

Thank you for the reply, but I’m not sure I undestand what you mean. Could you elaborate?

You’ll need to do what @Vinc3r did in his PG, which is to do it programmatically by loading the lightmaps as separate textures and assigning them to the right materials:

3 Likes