I have the following problem:
We do have the need to render high quality soft shadows which we can achieve using PCSS. As you know does this have a major performance drawback, especially on mobile devices.
The problem is that we cannot pre-bake all shadows in blender as we have semi-dynamic objects in the scene that will change once but then stay static until they are changed again.
Changing the shadowmap refresh rate to 0 obviously helps in terms of performance and is what we are currently doing. Still, the shadowmap needs to be rendered and filtered every frame and this is what is simply too slow on mobile.
Therefore Iām asking myself if there is any way to basically bake the shadow into the shadow receiving objects of the scene?
It should be possible to render the shadow in UV space and then use that as a lightmap.
Youāll need to do the uvunwrap in blender and export the scene but it should be possible.
Might be possible with a material plugin?
cc @Evgeni_Popov
@labris we are currently using spotlights and no directional lights (so light.autoUpdateExtends = false has no effect - but it obviously also doesnāt solve the issue when we use directional lights).
@Cedric Iām no entirely sure how to go about that as I didnāt find a way to somehow read the filtered shadowmap. Could you point me into the right direction?
The bunny is rendered in a separate RTT with a special material which renders the shadow component into mesh uv space. After 3s, another bunny is displayed with a material that uses the baked shadow to retrieve the shadow component.
As you can see, there are artifacts, because of uv seams (the camera is close to the bunny so you can better see them). I havenāt looked into it, but this technique could be used to mitigate them: