I am trying to export the generated shadowMaps from the inspector to use them for a static scene. Of course I can bake these shadows in blender but it would be much more convenient to get the exact same shadow texture without creating the scene in blender. Since the texture is visible in the inspector I am curious how to extract it.
You may not even need to do that as you can simply set the shadow maps to be updated once. They will then be reused and not recomputed: Shadows - Babylon.js Documentation
That would be the most convenient way. Thanks for the hint.
Unfortunately the shadow textures are empty after setting refreshRate = 0 and autoUpdateExtends = false. Even though I set the values after adding the meshes to the renderlist. Am I able to wait for the first computation?
I also noticed that the shadow disappears if I dispose the shadowGenerators or even the lights. Is it possible to keep the shadow textures without the lights? I want to have as less element in my scene as possible. Since I get my light from the IBL it is not necessary to keep them.
This will require a repro in the PG to help you further
I would love to be able to keep the shadow anyhow, although I dispose the shadowGenerator and the lights. I noticed that my scene has a lower fps with shadowGenerator and lights. And since I get my light from the environment I don’t need it except for creating the shadow.
It’s no problem for me to create a small ground which has a texture with the shadowMap on it. But I don’t no how to use the dynamically created shadow texture.
You can’t dispose the light / the shadow generator if you want the shadows to be generated.
They are still needed, even if
refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE. This setting means the shadow map will be generated only once, but the objects receiving shadows must still use a specific shader to display shadows, and for this to work the light/shadow generator must exist.
This is not like a baking process, where the shadows would be embedded in some textures that would be added as lightmaps to objects: Babylonjs does not support this (yet?).
We do it have baking support (yet)