@theblackneko, you can certainly create a shadow map for a material using tiled textures utilizing a second UV set. You would have the tiled UVs in the first set and the unique unwrap in the second set which the shadow map is assigned to. In Babylon.js, you can assign light maps to PBRMaterial (which would be what you would have importing a glTF).
The way to assign the lightmap to be a shadow map is to set PBRMaterial.useLightmapAsShadowmap = true
and then assign the UV set with PBRMaterial.lightmapTexture.coordinatesIndex = 1
which would set the texture to use the second UV set. All textures have the first UV set as coordinatesIndex[0]
so the second UV set will be index 1.
The real issue here is that you ask to be able to pass a shadow map out of Blender into a glTF and as far as I know there is nothing in the spec or any extensions that enable lightmaps as part of the glTF format. @bghgary can correct me if I am wrong about this, but I looked through the spec and available extensions and I don’t see anything about lightmaps or baked lighting in glTF. I believe the preference is to let the engine handle the baking of lights for the transmission format since including that information in the glTF would limit how the asset could be used as it would no longer accurately adhere to the lighting of the scene it was imported to.
However, if you are looking for how to do this in Babylon, you simply need to create your tiling material in Blender as normal and add a second UV set to bake your shadows. Then export your glTF and export the shadow map as a stand alone texture. You then load the glTF and load the shadow texture separately and just append the shadow map texture to the PBRMaterial by setting:
PBRMaterial.lightmapTexture = myLoadedShadowTexture PBRMaterial.useLightmapAsShadowmap = true PBRMaterial.lightmapTexture.coordinatesIndex = 1
I hope this helps, but feel free to ping back if you have more questions.