Search Unity

Universal RP Shadow problem - Gaps

Discussion in 'Universal Render Pipeline' started by cfree, Oct 3, 2019.

  1. cfree

    cfree

    Joined:
    Sep 30, 2014
    Posts:
    72
    Hi guys...
    Looking forward to use URP...
    But i have a shadow problem using simple objects... se the image attached... the shadows contains gaps that should not to.

    Tried improve shadows reolution (even 4096), an increase shadow cascade count to the max (4), without success.
    Messing with Depth Bias and Normal Bias can solve the gaps, but then introduce other shadow problems...

    Please, anyone can point me on the right direction?

    Shouldn´t it work out of the box? Tried Unity 2019.2, 2019.3, 2020.1, default URP versions.

    Thanks!
     

    Attached Files:

  2. cosmochristo

    cosmochristo

    Joined:
    Sep 24, 2018
    Posts:
    250
    Where is the scene origin in relation to your buildings?
    How large are the buildings?

    I ask because there are two possibilities that I can think of:
    either you actually have gaps or you are dealing with too low 3D resolution.
     
    Last edited: Oct 3, 2019
  3. cfree

    cfree

    Joined:
    Sep 30, 2014
    Posts:
    72
    No buildings, the objects are two simple crates.

    One is provided by an Unity tutorial, the another is a simple box with inset faces made in Blender for testing. The two are one or two meters.

    Too low 3d resolution... maybe... the meshes are very low poly... but if it is the case i need to increase the mesh resolution? I don´t think it is a good solution, but i will test when i get the chance.

    Thanks.
     
  4. cosmochristo

    cosmochristo

    Joined:
    Sep 24, 2018
    Posts:
    250
    What I am trying to find out is what are the coordinates of the crates, and the viewpoint for that matter. 3D resolution reduces with coordinate size. Some similar rendering problems occur from this: I have measured changes in lighting occur (shadows) when the scene is moved from (0,0,0) to (0,0,900). If they are only small crates then I don't expect this to be the issue, but it is something that should be ruled out.

    Also, your camera scale (1,1,1) or smaller?
     
    Last edited: Oct 4, 2019
  5. cfree

    cfree

    Joined:
    Sep 30, 2014
    Posts:
    72
    All default settings. Open Unity and put a cube (with inset faces) in the scene.
    Noticed it do not happen with HDRP, only URP and built-in.
    I think i can live with changing the shadow bias options in the light, but would love to know what is the problem.
     
    oleg_v likes this.
  6. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    This is because normal bias. Vertices on the cube edges are not stitched and have different normals directions. So normal bias push polygons in different directions and it's introduce gaps.
     
    AznableMiao likes this.
  7. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    482
    Use two sided option in mesh renderer > cast shadows
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    or bevel your crates which introduces more polys but enhances lighting and fixes the gaps as well.
    if you need a low poly count you could simply smooth all normals on the mesh (so that the shadow caster pass will not break the vertices and introduce the cracks) and re-indtroduce the harsh normals in the pixelshader.
     
  9. discofhc

    discofhc

    Joined:
    Dec 18, 2017
    Posts:
    47
    There is no way to solve this problem in engine (URP)?
    Getting gaps on shadows for every low poly asset i use... kinda hard to move forward...
     
    Chukwuazam likes this.
  10. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    You need to reduce the "Normal Bias" shadow setting and it will close the gaps.
     
    ahSOLO1 likes this.
  11. oleg_v

    oleg_v

    Joined:
    Nov 10, 2017
    Posts:
    68
    Seems to be necropost, but...
    Reducing "Normal bias" for main light or for URP "UniversalRenderPipelineAsset" produces other artifacts - sharp edges on curve surfaces when normals are near 90 degrees to (sun) light direction.
    And it can be avoided by increasing "Depth bias".
    Example config works for me: "Depth bias" = 5, "Normal bias" = 0.07.