Search Unity

URP shadows and light have strange artifacts

Discussion in 'Universal Render Pipeline' started by michaelday008, Sep 27, 2021.

  1. michaelday008

    michaelday008

    Joined:
    Mar 29, 2019
    Posts:
    135
    I've looked up several threads that said this type of stuff was fixed months ago, but I'm testing the latest Unity LTS (2020.3.18f1) and the Latest URP.
    It seems that odd artifacting issues persist and this is preventing me from moving my project to URP.
    Perhaps there is some series of settings I need to do to get rid of these artifacts and bad defaults, but my issue is that everything that I show using the built-in pipeline for comparisons below required no optimization. The built-in pipeline defaults just worked out of the box with no fiddling around whereas the URP defaults are terrible out of the box.
    In my scene, there is only a single directional light, so this post doesn't even begin to touch upon the issues with point lights that other posts refer to.

    To summarize here are the main problems with URP shadows and lighting currently.
    • particle system has strange artifacts
    • shadows get cast on transparent objects
    • shadows have strange artifacts
    • post processing system doesn't apply camera fog depth to character, and applies it too strong to environment.
    I'll post a bunch of pictures here to show all the issues.
    Image 1: stange horizontal banding issue with URP shadows
    FootShadows.png
    Image 2 : built in pipeline shadows without banding for comparison
    normalfootshadows.png
    Image 3: built in pipeline particle effect where everything looks smooth
    normalPoison.png
    Image 4 : URP particle effect with really bad banding and color distortion with everything too white and bright
    poisonartifacts.png
    Image 5 : URP shadows on a character with bad banding in all the circled spots
    URPUMAartifacts.png
     
    Last edited: Sep 27, 2021
  2. michaelday008

    michaelday008

    Joined:
    Mar 29, 2019
    Posts:
    135
    Due to 5 image limit per post, here are some more artifacts

    Image 1 : built in pipeline transparent water without shadows, water is a good color
    water.png
    Image 2 : URP transparent water with shadows on transparent object and water looks neon blue instead of a nice dark blue
    WaterURP.png
    Image 3 : built in pipeline post processing fog effect with good fog on both character and water that becomes appropriately stronger with distance from camera
    WaterFog.png
    Image 4 : URP post processing with character receiving no fog and environment receiving so much fog you can't see anything
    WateFogURP.png
    Image 5 : More strange banding issues with URP shadows
    URPUMAartifacts2.png
     
    Last edited: Sep 27, 2021
  3. michaelday008

    michaelday008

    Joined:
    Mar 29, 2019
    Posts:
    135
    And here are the final 2 artifacts for this post.

    In the first image, you can see the built in pipeline with some small shadows near the corner, but in the second image, you can see with URP that those artifacts are highly triangular and exaggerated.

    cubeEdges.png
    CubeEdgesURP.png
     
  4. turborilla-hans

    turborilla-hans

    Joined:
    Sep 28, 2020
    Posts:
    2
    I'm having similar issues since "upgrading" from the legacy renderer to URP ( v10.7 ). In our case its most noticeable on terrain, specially where the angle between directional light direction and the surface normal is near 90 degrees. Changing normal bias or depth bias doesn't change it (just shifts the error). Same goes for cascade setup and shadow resolution. The effect just gets more or less "sharp".
     
    LordCafe likes this.
  5. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    This is an issue of shadow resolution (or rather, relative resolution on the shadow map). I asked before about the shadow quality difference, and at least some of those artifacts is because URP is using a conservative projection matrix for shadows. So the relative resolution of shadows in URP is much lower than builtin (depends on scene geometry; if you have big pieces of geometry like terrain or buildings then it will be a problem), even though the actual texture is the same resolution.

    This may or may not be fixed eventually, but don't hold your breath. You can use 4 cascades + tons of soft shadow blurring to mostly mitigate it, but of course this comes at a performance cost. I eventually went with "screw this; I'm implementing stencil shadows". If all you need is a single directional light and are OK with requiring compute shader support, I might be able to hook you up (it's open source, but not very easy to use; posted a bit about it over here).

    The other artifacts (ones from your first 2 posts and @turborilla-hans 's picture) must be caused by something else. Sorry I can't be more helpful. URP shadows are a bit of a mess.
     
    andreiagmu, YJack and PutridEx like this.
  6. LordCafe

    LordCafe

    Joined:
    Aug 26, 2015
    Posts:
    35
    Did u find any fix for this? i'm almost going back to built in or switching to HDRP...