# Shadow Jitter when moving the sun

**URL:** <https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069>\
**Category:** Rendering\
**Tags:** shadow, shadow-problem, unreal-engine, question\
**Created:** [July 21, 2015, 10:03pm UTC](https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069 "2015-07-21T22:03:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_31953c13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_31953c13](https://forums.unrealengine.com/u/anonymous_user_31953c13)\
**Post date:** [July 21, 2015, 10:03pm UTC](https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069/1 "2015-07-21T22:03:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MrGrr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrGrr](https://forums.unrealengine.com/u/MrGrr)\
**Post date:** [July 22, 2015, 5:19am UTC](https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069/2 "2015-07-22T05:19:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_31953c13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_31953c13](https://forums.unrealengine.com/u/anonymous_user_31953c13)\
**Post date:** [July 22, 2015, 10:28am UTC](https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069/3 "2015-07-22T10:28:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![makai](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@makai](https://forums.unrealengine.com/u/makai)\
**Post date:** [July 22, 2015, 10:32am UTC](https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069/4 "2015-07-22T10:32:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_31953c13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_31953c13](https://forums.unrealengine.com/u/anonymous_user_31953c13)\
**Post date:** [July 22, 2015, 10:49am UTC](https://forums.unrealengine.com/t/shadow-jitter-when-moving-the-sun/326069/5 "2015-07-22T10:49:24Z")

</div>

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  
…
