Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted Why is my shadow so filed with holes

Discussion in 'General Graphics' started by lucaskargreen, Sep 20, 2020.

  1. lucaskargreen

    lucaskargreen

    Joined:
    Sep 10, 2020
    Posts:
    21
    upload_2020-9-20_18-35-59.png

    The Voxel character is solid, standard lighting settings pretty much
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    10,907
    This is an artifact of a mesh with hard edges and Unity’s “normal bias”. There are three options I can think of to solve the issue:

    1. Set your light’s Normal Bias to 0.0. You may have to increase the light’s non-normal Bias to compensate. Means worse peter panning (gaps between the shadow caster and the shadow) or more shadow acne (striped or boxy artifacts) or both. But it doesn’t require any more work.

    2. Use two meshes, one for rendering what you see which is what you already have, and one that has smoothed normals that is for shadows only. Kind of a pain because now ever mesh needs a duplicate mesh, and you have to keep them in sync, but should solve the issue.

    3. Use one smoothed normal mesh for both the rendering and shadow, but use a shader to do the flat shading instead of the vertex normals. May even render slightly faster as it can reduce the vertex count quite a bit. But doesn’t work on OpenGLES 2.0 devices if for some reason you were still planning on supporting those.
     
  3. MojaveHokage

    MojaveHokage

    Joined:
    Jul 21, 2021
    Posts:
    1
    I found that going into the object's Mesh Renderer and setting "cast shadows" from 'On' to 'Two Sided' fixes the issue.

    upload_2021-7-28_14-7-33.png

    upload_2021-7-28_14-7-59.png
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    10,907
    This can fix it, but isn't guaranteed, and will depend on the model. The gaps are still there, and will show up in some lighting angles, they're just hidden where the gaps in the front and back faces don't line up.
     
unityunity