Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Normal shading direction is opposite sunlight?

Discussion in 'General Graphics' started by vsnry, Dec 8, 2018.

  1. vsnry

    vsnry

    Joined:
    May 4, 2018
    Posts:
    35
    I made some blocky terrain generation code, and it works perfectly, but for some reason the normals are getting shaded from the completely opposite side.

    As you can see in the video, the sunlight is going right to left, but the mesh is getting shaded as if the light was coming from the left to the right.

    https://i.gyazo.com/ce22bc09999d46f37b2f650f79904665.mp4

    Any ideas on how I could fix this?
     
    Last edited: Dec 8, 2018
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    How are you generating the mesh normals?
     
  3. vsnry

    vsnry

    Joined:
    May 4, 2018
    Posts:
    35
    Nevermind, it seems that it was a bug with my material. I don't know how it happened, but making a new material fixed it.