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

Prevent lighting going through objects

Discussion in 'General Graphics' started by Shadowing, Oct 19, 2016.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,628
    So I have a huge planet in my scene. When I fly my ship on the dark side of the planet the light still hits my ship.

    How can I prevent this? I have shadows on the planet checked on.
     
  2. Myrmidou

    Myrmidou

    Joined:
    Jun 7, 2014
    Posts:
    30
    Hi.

    Is your planet checked as a static gameobject?
    How is set your project lighting and the active light of your scene (Sun?)?
     
  3. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,628
    Hey Myrmidou thanks for the response. I have the planet check as non static and using directional lighting
     
  4. Myrmidou

    Myrmidou

    Joined:
    Jun 7, 2014
    Posts:
    30
    It could be a lot of things. Settings your planet as static does nothing?

    Try to change values in your light component, in Window>Lighting & in quality settings, it may change something.

    Perhaps "shadow distance" in quality settings? If your scene is at a right scale then your ship should be really far from your planet, so the default shadow distance value should be changed accordingly.
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,628
    Ya setting it to static did nothing at all.

    Nah the planet isn't at the right scale. Cause im allowing players to fly around the planet in a reasonable time.
    I"ll check out light settings.
     
  6. GilesDMiddleton

    GilesDMiddleton

    Joined:
    Aug 12, 2015
    Posts:
    91
    When I was developing a space game, I noticed that lens flares would seep through planets. Not the same issue - but it was solved by adding a sphere collider! Another idea - make sure your light isn't excluding the ship/planet by its culling mask.
     
  7. Cynikal

    Cynikal

    Joined:
    Oct 29, 2012
    Posts:
    122
    Do you have shadows enabled? If they are not enabled, it wont care whats in the way. It'll illuminate everything. Turn them on, and the problem should be fixed.
     
  8. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,913
    Sounds like it might be an issue of using a very large scale. You'll have to come up with workarounds for that. Shadow Distance maybe? Maybe you could just kill almost all ambient real time lighting and make it very dark in every space of the universe and then gradually add illumination from stars, etc and see how that works?
     
  9. GilesDMiddleton

    GilesDMiddleton

    Joined:
    Aug 12, 2015
    Posts:
    91
    If it is an issue with large scale - I used the floating origin trick and layered cameras in a game I started (but not finished), @Shadowing might be interested... https://gilesey.wordpress.com/?s=spacelife
     
    JamesArndt likes this.