How to render shadow map one time

I found a tip of threejs about shadow rendering here:


  1. If your scene is static, only update the shadow map when something changes, rather than every frame

Is there anyone can tell me how to achieve this? when I set the castShadow to false. the shadow map just disappear.

You can do this by setting renderer.shadowMap.autoUpdate to false. If an update is required, set renderer.shadowMap.needsUpdate to true.



Oh yes! that’s really cool!

1 Like

I found this trick can’t significantly improve performance of shadow rendering on smart phone. see pictures below:


test code (most of them copied from mugen87’s jsfiddle demo):
@Mugen87 @looeee

Probably because computing the shadow map is no real performance bottleneck in this simple app.

But, if I disable the shadowmap, and fps value will up to 60.

I think we need to differentiate between rendering a shadow map and just updating it.

what do you mean by just updating it? You mean eliminate the animations and timeout ? If so, I have already do that , and it is unhelpful.

There are two steps when using shadow mapping. The shadow map is generated and then used as a texture. renderer.shadowMap.autoUpdate controls the first part of this process.

Does this controls the projection of a shadowMap to every surface?

As I said before, it just controls the update process of the shadow map. I suggest you study in more detail how shadow mapping works, then this topic will be more clear to you.

1 Like