Why is my shadow so filed with holes

6330711--702588--upload_2020-9-20_18-35-59.png

The Voxel character is solid, standard lighting settings pretty much

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.

15 Likes

I found that going into the object’s Mesh Renderer and setting “cast shadows” from ‘On’ to ‘Two Sided’ fixes the issue.

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.

6 Likes

playing with the normal bias worked out for me, i always wondered how to fix this and previously i used 2 meshes, to only cast shadows only, few years later, still helping folks, thanks bud