How do I attach a baked shadow map to my model

Hi, not sure what this example is but I believe it must be using a baked lightmap/shadowmap.
There’s this tutorial made by @Vinc3r that surely can help you for the understanding of how to create a lightmap in Blender and load it in BJS

There are also a number of other topics in the forum around the technique of using ‘shadow map’
Since Blender generates by default PBR Materials and you might want to keep with these, you would just need to make sure you assign your lightmap texture to the correct channel and also make sure that any properties or additional lights and env you create will not affect your baked shadows (or not all too much). Here’s another link for you around this:

Best would be if you could share a playground (even non-working) just importing your model, textures and your ‘attempted’ lightmap. From there, it will be easier to give you tips on how to improve it.
Others might have more links or tutorials to share but meanwhile, you can make a search in the forum around ‘lightmap’ or ‘shadowmap’. You’ll see that there’s plenty to read about and lots of PGs to discover.
Hope this helps (a little) and meanwhile, have a great day :sunglasses: :sunglasses:

Edit: Sorry, just realized that in the second link I gave you, the links in the PG are broken. But the code is fine. So, for the short answer, you want to assign your lightmap to:

mymatmap.lightmapTexture = new BABYLON.Texture(“textures/mylightmap.png”, scene);
mymatmap.useLightmapAsShadowmap = true;

Where ‘mymatmap’ is your model texture map/wrap.

3 Likes