Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Constantly Moving Directional Light Makes Shadows Flicker

Hi all,

I've just added the 'Geographically Accurate Sun Position' plugin to my project (it was added in 4.21) and I am trying to make the sun constantly move across the sky in a day night cycle. I setup code to update the time values in the Sun Position BP every tick. The sun moves perfectly and overall the shadows follow it, but looking closer the shadows are now constantly flickering, with lines of shadow moving across the landscape. Here is a picture: alt text

These lines are constantly moving and flickering. I tried reducing the frequency that the sun position was updated, but it just made it flicker slower and also made the sun too jerky for my liking. What can I do to make the shadows move smoothly?

Product Version: UE 4.21
more ▼

asked Dec 15 '18 at 10:12 AM in Everything Else

avatar image

47 5 10 19

avatar image Slimwaffle Apr 04 '19 at 09:09 AM

I am getting the same thing when moving my sun using a timeline. Did you find a fix for this?

avatar image MarsMiner Apr 04 '19 at 04:36 PM

No, haven't found anything yet. Do let me know if you come across a solution.

avatar image duderseb Apr 04 '19 at 06:19 PM

Hello. Does the shadow flickering only happen on the landscape or also from the shadows cast by the rocks?

avatar image MarsMiner Apr 04 '19 at 07:05 PM

I think it's just on the landscape but the rocks are so small they don't really have a shadow anyway

avatar image duderseb Apr 04 '19 at 07:34 PM

Alright, can you try and zoom or scale up one of the rocks to verify whether it's happening to them too? It's a bit tough to go off so little info so I'm gonna shotgun you with some potential solutions to try: Is the landscape a Static Mesh or you made it in-Editor? Does its material use a Normal map? If so, disable it or set a flat one (R=127,G=127,B=255) and check if the issue persists. Try adjusting these settings in your directional light: Increase Shadow Bias. Decrease the Shadow Filter Sharpen. Make sure Cast Dynamic Shadow is checked. Increase Dynamic Shadow Distance. Increase the Number of Dynamic Shadow Cascades.

avatar image MarsMiner Apr 05 '19 at 11:51 AM

Ok, I'll try those things now, I'll tell you what happened in a couple of minutes.

avatar image MarsMiner Apr 05 '19 at 12:09 PM

I've tried everything you said with no success. I put a cube into the world-it was also affected by the flickering shadows and the shadow it cast itself was also affected, so it seems all shadows in the world have this problem. Removing the normal map from my landscape did nothing. I tried all the adjustments to the directional light that you said, but none of them stopped the flickering. What more information can I give you that would be helpful?

avatar image duderseb Apr 08 '19 at 03:40 PM

Hey there, sorry for the late response. I'm away from UE at the moment but in the meantime can you tell me about the terrain, is it a static mesh? If so, Stationary/Moveable? Can you try creating a new level, add the terrain, and rotate the default light manually to see if you get the same flicker?

avatar image MarsMiner Apr 09 '19 at 07:10 AM

It's a landscape, done using level streaming. But clearly that doesn't make a difference, because when I put a cube in the level (static mesh) it had flickering shadows on it too. I tried changing the mobility of the cube but it has the same flicker if it is on stationary or movable. When I rotate the directional light manually the same flicker persists.

I think most likely the problem is that the shadows have some element of randomness in them and because I move the directional light every frame, this is re-calculated every frame and therefore the shadows look subtly different each frame. This would explain the flicker. The only question is now how can I get rid of it or work around it?

Thanks for all your help on this.

avatar image Slimwaffle Apr 05 '19 at 11:55 AM

I haven't found a complete solution for this myself. But I am having some success getting rid of the ripples. I can't do anything about shadow flicker though. What I decided to do was code around the issue. So when the sun position is at those really low angles and shooting shadows across the terrain, I am disabling shadows and the re-enabling them once the sun gets higher in the sky. Hope this helps.

avatar image MarsMiner Apr 05 '19 at 12:09 PM

Thanks, but I don't really think this would work for me as I need shadows all through the day. Thanks for commenting it though, may help others

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

So not sure if this helps but after I coded around the ripples I noticed something about the flickers. For me they only flicker on Medium settings. At low shadows disable. And on High and Epic it doesn't flicker for me.

more ▼

answered Apr 09 '19 at 11:08 AM

avatar image

1 1 3

avatar image MarsMiner Apr 11 '19 at 07:16 AM

Strangely, this doesn't work for me. The flicker is perhaps a little less noticeable at higher qualities but it is still quite obvious.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question