Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Lighting creates sharp shadows, doesn't gently fade

Discussion in 'Scripting' started by AxisRob, Nov 30, 2015.

  1. AxisRob

    AxisRob

    Joined:
    Aug 6, 2013
    Posts:
    33
    I'm making a voxel engine as a project, and I've hit a lighting snag.

    Basically, when you punch out some blocks and walk in, the shadows from Unity's lighting system don't gently fade off. They just sharply appear.

    Instead of a realistic "The deeper you go the darker it gets" type of system, you get a "Lit by sun or cast into shadow" is/isn't type of transition.

    I tried messing with the directional lights lighting the scene, it did nothing.

    How do I make smooth, drop-off shadows? Do I need to roll my own lighting solution?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,798
    This is generally handled with ambient occlusion or ambient obscuration, basically some type of "closer I am to a deep notch in geometry, the darker I make the pixel."

    There are various runtime solutions to this, including screenspace techniques such as SSAO that approximate the effect for runtime use.
     
  3. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Alternately - make your ambient light color black.
     
  4. AxisRob

    AxisRob

    Joined:
    Aug 6, 2013
    Posts:
    33
    I made it black to try, it did not go smoothly. It doesn't go from lit to shadowy to black.

    It just goes from lit to pitch-darkness. Sunlight next to midnight-shadow.