Shadows become slow when enabling Bloom Filter

Hi, everyone!

I’ve got a problem, which I’m not able to deal with for some time.

I have a Spotlight sun, moving along Motion Path arch exported from Blender - like the real Sun. And I have a Train and the main camera, which are moving along the game world with high speed. The sun is a shadow caster, and shadows are just basic Panda3D shadows for now.

Everything works fine until I’m adding Bloom Filter:

filters = CommonFilters(base.win, base.cam)
filters.setBloom(size="large", mintrigger=0.8, intensity=2)

In that moment shadows become slowly:

If I’ll slow the Train down, the shadows become normal, but on high speed it looks like shadows are rendered with a delay - the tree is already moved several pixels to the left along the screen, but the shadow is still on the old position - it doesn’t even start at the same position (I’ve set higher contrast on the screenshot to make it easier to see).

Did you ever see something similar, is there a way to fix it? I’d like to use both Bloom Filter and shadows. Thanks in advance!

Yes, it’s an issue with the sorting of the buffers. The default sort of CommonFilters is -1000, but the default sort of the shadow buffers is -10, which will cause the shadows to be rendered after the main scene.

You can pass sort=-2000 to the setShadowCaster call to fix this issue. A future version of Panda3D will change the default sort value of CommonFilters to fix this problem.

1 Like

Nice, it’s working. Thank you very much!