Hello, I have an issue with the shadow map that jitters when it moves.
The project is the same as discussed there :shaderMaterial and 300es imports in MRT - #37 by Mikael
So I have a an MRT as target rendering for the whole scene and the meshes of the scenery is made of thin instances.
My goal is to reduce the frustum to the part that are supposed to be viewed and then move it with the character. (so narrower then finer shadow map)
I’m not done with the maths of evaluating the ortho top, bottom,… yet that I already see that moving the light source or its angle makes the shadow jitter.
I’ve recorded it:
So I create a playground to try reproducing it: https://playground.babylonjs.com/#8RU8Q3#51
but in vain, the jittering doesn’t appear and weirdly while the sphere’s instances cast shadow it seem that only one sphere in the middle renders, weird.
Dunno if you guys might have leads to what produces it so I can reproduce it in the playground and maybe fix it.
For info I’m using the 5.0.0-alpha-44 but I think it happened with the 4.2 too.
indeed thanks!
ok but in the example the textures are rendered on planes but my goal is that the main MRT is the target render so I use the pipeline effect to bring it back to the main buffer which is the way I render on my game thus I think that way might reproduce the jittering. https://playground.babylonjs.com/#8RU8Q3#63
but I have an e is undefined and I don’t know where it comes from.
https://playground.babylonjs.com/#8RU8Q3#64
yes I forgot that this copy pasting, so I managed to reproduce the jittering effect!
Now we have the real bug I’m trying to fix.
you notice I’ve putted slow updated to put emphasis to that jitter, it shows more by flashing at the beginning of the animation.
It’s an ordering problem because the MRT is generated before the shadow map is (re)generated for the new light position, so it’s using the old shadow map from the previous frame. Push the MRT in the camera.customRenderTargets array instead of scene.customRenderTargets: