Search Unity

Shadow Artifact Problem (bug?) on Terrain (Solution)

Discussion in 'Editor & General Support' started by Andrew_atl, Mar 11, 2011.

  1. Andrew_atl

    Andrew_atl

    Joined:
    Sep 21, 2010
    Posts:
    103
    Hey I'm new to Unity since 3.0, and whenever I would add a terrain, then a directional light and turn shadows on I would get artifacts everywhere(pic on left), and reading around a few people seemed to have this problem, most suggested to change shadow settings and quality, which I tried to no success, so just playing around I found if I rotated the light on the Z-axis to around 230, or -120, it would get rid of the artifacts (pic on right). Just thought I'd post this fix if anyone else is having this problem, and see if its a bug or I'm doing something wrong.

     
    Last edited: Mar 11, 2011
  2. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    You need to increase the bias a little, that should fix it.
     
  3. Andrew_atl

    Andrew_atl

    Joined:
    Sep 21, 2010
    Posts:
    103
    I had already tried that, and it did make it look better, but I had to crank it to the max which messed with how the shadows looked, and there was still artifacts, but rotating the light actually works better, which is fine since z-axis doesn't change the angle of the light or anything.. Just a weird thing.
     
    Last edited: Mar 11, 2011
  4. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    I have similar problem, changing bias does not doo big difference, rotating light yes. It is not perfect, but in most cases it almost OK.This is deffinitely bug.
     
    Last edited: Mar 26, 2011
  5. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    I tried on totally different HW and same problem. I made bug report for this for the third time, maybe this time somebody will notice.
     
    Last edited: Apr 19, 2011
  6. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Have you tried on Unity 3.3?
     
  7. Charz

    Charz

    Joined:
    Apr 15, 2010
    Posts:
    20
    I have been having the same issue even in 3.3 and is annoying me a lot. It is mostly related to the size of objects being shadowed ( a terrain for example) and can be reduced by increasing the shadow bias. however to really eliminate the artifact, one would end up with shadows noticeably detached from the objects due to the large bias.

    I also found another issue with directional shadows. If you set the "Near Clipping plane" in the camera settings to something below 0.3 and have a relatively large terrain ( 2000-4000 span), the shadow on the terrain features will start to pulse (appear and disappear quickly) which is not tolerable at all. You can set the near clipping plane to a very small figure and see how visible the artifact becomes.

    The problem disappears when setting higher near clips but with a drawback of being able to see through walls! unless you increase your character controller's radius. however this will make a very fat character who would get stuck every where...

    I really ask the folks in Unity to pay further effort to fix or at least find a work-around to the aforementioned issues.
     
  8. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Which graphic card do you have? Anyway I made bug report for this long time ago, no reply at all.

    Shadow shaking can be solved by setting shadow cascade to four, instead of two, or one. Anyway i dont understand why is such setting there, because without it it is useless and there is no noticable performance loss.
     
  9. Charz

    Charz

    Joined:
    Apr 15, 2010
    Posts:
    20
    Geforce 8800M GTX

    The issue occur even when maxing out all quality settings eg. 4 cascades, high res, etc... even reducing shadow distance does not make any difference at all.

    the only three solutions that would limit the artifacts are reducing Near clipping plane, increasing shadow bias and the reducing the size of your scene. But as I stated earlier, these also pose new problems that may not be tolerated.
     
  10. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Only sollution is to make bug report every day, until somebody finally do something.
     
  11. Mingo

    Mingo

    Joined:
    Nov 14, 2010
    Posts:
    39
    Dynamic terrain shadows have been "broken" in this way forever. It's a common shadowing artifact that every engine will run into. You can (as has been mentioned) mess with the bias and clipping planes and pray.

    Google for "shadow acne" for some examples. There are ways to limit and improve the problem and some technical articles (GPU gems, etc), but there have been no visible improvements to the horrible moiré and self-shadowing artifacts inside Unity for years. It looks like they're already using some of the common techniques, but IMO it renders dynamic shadows on terrain useless. If you really need these, try a different engine.
     
  12. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Well, this is not sollution. Sollution is to kick Unity team to do something with it, we are in 2011.
     
  13. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    well, there were lots of improvements for shadows in 3.4 (will be released shortly) - so just wait and try again
     
  14. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
  15. eagle555

    eagle555

    Joined:
    Aug 28, 2011
    Posts:
    2,705
    I had the same problem...

    Try: disable 'cast shadows' of the Terrain in the Terrain Settings...It fixed the problem for me, no more artifacts on the terrain...
     
  16. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Well, this really helps for terrain, but terrain should cast shadows, so this is not fix, just turning off bugged feature. And it of course does not solve same problem with meshes.....
     
  17. Josh707

    Josh707

    Joined:
    Jul 12, 2012
    Posts:
    71
    Wow, surprised to see this 'bug' still exists in Unity 4.1. Unity's dynamic lighting seems to be really bad... I can't light a simple log wall without the shadows flickering and never being accurate.
     
  18. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    Yep, I have the same problem.. Tried rotating, bias, bug report and no solution in July 2013.

    This doesn't happen in UDK(Cant wait to hear a fanboy make a suggestion) Unity team seems to be monopolizing and leave the basics behind, hopefully one day we will have some competition that will concentrate more on improving the engine instead of expanding platforms. (terrain with height map 1024 costs 740 draw calls)...

    Been using unity in the 1.x cycle so I dont really want to change engines besides I like unity a lot more then UDK but if there was even a decent alternative I'd move, and yes I own a pro unity 4 license
     
    Last edited: Jul 19, 2013
  19. jchapman723

    jchapman723

    Joined:
    Jan 27, 2014
    Posts:
    27
    Does anyone know if there has been a solution to this issue in 5.0? I'm still getting the shadow artifacts after messing with a variety of settings. Changing the near clip plane and upping the bias are the only things that help but those are terrible solutions.
     
  20. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Agreed, increasing the bias causes peter panning. This is really not a problem in other engines.
     
  21. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    okay, I was having this problem with shadows on terrain:


    I turned HDR off and on again and also switched the rendering path (on the camera) from deferred to forward and back to deferred again and the problem is gone, I don't know exactly what happened but the problem just vanished.
     
  22. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Well, that thing just came back and I have no idea why.

    edit: turning down the near clipping plane solves the issue, the problem is that you can't control the scene view camera clipping planes so this issue will sometimes happens in the scene view and the only solution is framing a big object or holding alt and moving the mouse up (that adjusts the near clipping plane it seems).
     
    Last edited: Mar 5, 2016