How to optimize the shadow calculation in very big scenes?

I am designing a game with large scenes using Panda3D. It confuses me that calculating the shadow of the whole scene is quite consuming.
Setting the shadow caster with 512 like

self.lightNP.node().setShadowCaster(True, 512, 512)

is not enough for big scenes. The shadow edge is blurry. It turns clearer when I set 512 to 2048, 4096, … But that is too consuming.
I am wondering if there is an optimization way for this.

Hi, welcome to Panda3D!

You could limit the size of the light frustum not to encompass the entire scene, but rather only a section near the player that is currently in view. (The downside is of course that areas in the far distance may not be shadowed properly.)

There are more advanced shadow techniques that solve this problem, such as PSSM or Cascading Shadow Maps. Unfortunately, these are not currently implemented by Panda3D out-of-the-box (though they are implemented by third-party modules like RenderPipeline), and would need to be implemented in your own application. Feel free to file a feature request on the GitHub issue tracker for these.

Appreciate for your reply! :smiley: I think the first solution suits me very well.