Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[SOLVED] Back of mesh causing unwanted shadows

Discussion in 'Global Illumination' started by Terpal, Aug 18, 2018.

  1. Terpal

    Terpal

    Joined:
    Apr 5, 2018
    Posts:
    5
    Hi,
    I'm working on some lighting for a terrain generator with day/night cycle, and I'm running into an annoying issue. When my light source/sun is on the horizon, it shines through the back of the terrain and causes unrealistic shadows.
    Image: Picture of shadows.
    Image: Perspective from sun.
    The red arrow in the second image points to the mountains in the back that are shown in image one.
    In case it's not clear, the terrain is a "section" or "cutout", so, when looked at from the side, the bottom of the terrain can be seen through.
    My question is: how can I stop those types of shadows? I of course want the terrain mesh to be able to cast a shadow on itself, but not from underneath itself. I'm relatively new to Unity, and I've not played much with lighting at all. If there's anymore info I need to provide, please let me know.
    Thanks in advance!
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,916
    Switch to two sided shadows for the light.
     
    Terpal likes this.
  3. Terpal

    Terpal

    Joined:
    Apr 5, 2018
    Posts:
    5
    Ah, that works perfectly! In case someone sees this later - what I had to do was go look at the MeshRenderer on the terrain and switch its "Cast Shadows" option to two-sided, and that fixed it.