In different situations shadowmaps can be used for static objects that do not move often :
- a procedural city (big shadow maps),
- objects that move only when dragged….
In those situations we need shadowmap rendering, but not each frame. For example, once a part of a procedural city has been created, the buildings don’t move but the shadow rendering still uses a lot of computational power.
Here is the suggestion of a shadowMapNeedsUpdate = true
parameter to the WebGLRenderer the way verticesNeedUpdate
work.
Its value is checked in the ShadowMapPlugin and set to false just after :
if( _renderer.shadowMapEnabled === false || _renderer.shadowMapNeedsUpdate === false ) return;
_renderer.shadowMapNeedsUpdate = false;
This way the shadowmap is rendered once at the first render call, and if the scene requires the realtime shadowmap it has to be precised in the render loop. Otherwise it has to be precised in the functions that move/create/delete objects.
Thanks for the suggestion! It was pretty easy to implement😊
You can now do this:
Hey so happy I found this. This feature is totally undocumented! https://threejs.org/docs/#api/renderers/WebGLRenderer I was already doing something like this but it wasn’t as performant as this and this has massively increased performance in my app. Will open PR to get it into the docs.