For a non interactive application, I am trying to accumulate shadows in a render target to display an averaged version on the canvas.
I am migrating my algorithm from Three.js to Babylon.js but I am stuck because I don’t find a way to update the shadow map several times without updating the canvas.
The algorithm is the following :
1 - Move the light
2 - Render shadow to a render target 1 (here the engine should update the shadow map as the ligth has moved)
3 - Add render target 1 to a float render target 2
4 - Repeat step 1 to 3, N times
5 - Make the final canvas rendering by drawing the scene with render target 2 divided by N
As you can see, I am doing only one canvas drawing in Step 5.
In Three.JS, I simply call several times :
renderer.render(scene, camera, renderTarget1);
Each call updates the shadow map and render the output.
In Babylon, scene.render() doesn’t allow to use a render target as ouput (maybe I am wrong here ?).
I have tried to use customRenderTargets on Scene but I don’t find a way to update the shadow map manually. This is required as the light moved several times during a frame…
Any advice ?