Shadow Jitter when moving the sun

Hi,

I have a strange problem with shadows and dynamic sun. Basically I have the sun rotating at a certain speed, and I have a bunch of columns derived from basic cube mesh. As the sun moves, shadows move, BUT they jitter. I’ll try to explain - let’s say the sun is moving so that the shadow is getting shorter. Basically they move smoothly for a bit then suddenly pop a few pixels back where they were a second ago (so they got shortened , then suddenly they are a few pixels longer again), then they continue moving smoothly, then pop back, etc. Its purely dynamic - no lightmass is used. Also if I enable inset shadows on the mesh that seems to be fixing it, but from what I understand that increases performance cost. I’d prefer to avoid using inset shadows for every single static object out there. Also I tried playing with number of cascades, distance , etc, but jittery movement keeps occuring. Any ideas what this could be and how to fix it ? Thanks

Silly question, the sun is moving smoothly right? or the angle of the directional light i should say. theres no issues with the rotation code?

Hi,

Yes - I checked the rotation and the rotation is smooth (I printed the number in the logs then ran them through a simple program to check if there is ever non-decreasing part of the sequence. It all passed).
Also - I found another workaround - if I set Dynamic Shadow Distance to 0 under cascade shadow maps (basically disabling them) and then enable Distance Field Shadows (Use Ray Traced Distance), then the shadows behave correctly on static objects. But then I lose them on dynamic (seems that the limitation of distance field shadows is that they can’t be applied to deformations , skeletal meshes ,etc). But then I can set movable objects to “cast inset shadow” and that works ok. So that’s the workaround - but not sure if I m suffering a performance hit as compared to just using cascade shadows.

I am using deltaTick in the rotation. The sun movement is very smooth - the issue is not that the shadows jump suddenly into the new position, but rather that they smoothly shorten then suddenly pop back to a longer lenght, then continue falling down smoothly. If I disable cascading maps and use ray traced shadows the shadows are moving very smoothly and correctly. So it’s some issue with cascading maps I think. As an example here’s how smooth the rotation of the sun is (excerpt from my logs):
314.994659
, 314.828003
, 314.813629
, 314.788757
, 314.781738
, 314.743164
, 314.691559
, 314.680206
, 314.673828
, 314.667542
, 314.657715
, 314.651520
, 314.645264
, 314.639008
, 314.631958
, 314.626404
, 314.620758
, 314.614807
, 314.608582
, 314.602997
, 314.597595
, 314.592529
, 314.587463
, 314.582397
, 314.577393
, 314.572449

sound that you are not using the delta tick in your rotation…
watch this around 1:50 (time)


for getting smoothness you can lerp around the values if you update the sun on a low tick rate