Search Unity

Directional Light not casting shadows in all directions

Discussion in 'Editor & General Support' started by KeithW, Oct 17, 2018.

  1. KeithW

    KeithW

    Joined:
    Dec 15, 2017
    Posts:
    9
    This post is copied from General Discussion where help is not allowed. Sorry. I mistook General Discussion for Editor & General Support

    I have a scene with a directional light (Scene Light) and a light (SkyBox Light) as the sun with no shadows and a culling mask of Nothing to mark the sun position. When I trigger movement, it uses the following code which rotates the sun around the horizon, then raises it up (0.1 degrees), Repeat.

    Code (CSharp):
    1. azimuth = saveAzimuth + 0.1f;
    2. if (azimuth >= 360f)
    3. {
    4. azimuth = 0f;
    5. altitude = saveAltitude + 0.1f;
    6. if (altitude >= 180f)
    7. {
    8. altitude = 0f;
    9. }
    10. }
    11. saveAltitude = altitude;
    12. saveAzimuth = azimuth;
    13. skyboxLightTransform.eulerAngles = new Vector3(altitude, azimuth, 0.0f);
    14. sceneLightTransform.eulerAngles = new Vector3(altitude, azimuth, 0.0f);
    15.  

    As I understand this, it should show 360 degrees of shadow. It does not. It only seems to draw shadows from y (azimuth) 140 to 179 and -179 to -20 (or 140 to 320)

    Here is a video. The only relevant data is the Scene Light transform rotation x and y. The time changing at the bottom is an artifact of the previous programming. Sorry for the slight fuzziness, I was trying to reduce file size.http://neighborhoodinnovations.com/download/shadows.mp4
    The original (crisper) is http://neighborhoodinnovations.com/download/shadows_Unity 2018.2.9f1_‎2018-‎10-‎16_14-41-35.mp4

    Can anyone explain what I am doing wrong or how to fix this problem?

    It has been suggested that I adjust the direction the light is pointed. I thought that's what I was doing by adjusting the transform eulerAngles. When I watch the light in the Scene view it seems to be changing directions.

    Adjusting the altitude gives a smaller shadow. Here is an example with the altitude at 30. Also, there is a cycle in the scene view focused on the Scene Light.
    http://neighborhoodinnovations.com/download/shadows_2018_10_17.mp4

    I realize that there is no light shining on the scene from -20 to 140. What can I do to fix this?
     
    Last edited: Oct 17, 2018