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. Dismiss Notice

Question Vertex color shader graph. Incorrect lighting direction. Maybe a bug?

Discussion in 'Shader Graph' started by Jack-van-der-Bilt, Aug 9, 2020.

  1. Jack-van-der-Bilt

    Jack-van-der-Bilt

    Joined:
    Jul 13, 2015
    Posts:
    17
    Hello everyone!

    Today I started working on a procedural mesh generator that use vertex colors for shading. I set all vertices to Color.green and got it working fine yesterday. However, after I woke up I noticed that my lighting is not behaving the way I expected.

    When the mesh is lit up from behind, set color is visible. When lit from the front, it just turns pitch black as if it recieves no shading.

    Here are some screenshots:

    Shader Graph
    ldgMtldshG.png
    Mesh from the front (only generating / rendering the North facing faces for now. Just imagine this will be a nicely generated chunk later)


    XnV5WuoT7R.png
    Mesh from behind

    ZNNIUTEoCA.png
    Light source turned around, viewing mesh from the front like in picture 2.

    dZWZ5qs5Gw.png

    Does anyone know what might be going wrong?
    Should I consider this a bug?

    Thanks for the help!
     
  2. Jack-van-der-Bilt

    Jack-van-der-Bilt

    Joined:
    Jul 13, 2015
    Posts:
    17
    ughh, my editor didn't highlight the commented out line: `mesh.RecalculateNormals()`.
    My bad. Can anyone close this?