Search Unity

_MainLightPos and _WorldSpaceLightPos0 returning inverted values?

Discussion in 'Shaders' started by gwenvis, May 25, 2020.

  1. gwenvis

    gwenvis

    Joined:
    Aug 1, 2013
    Posts:
    18
    I'm using the shader graph for the first time and getting the hang on shaders, or at least trying to. While creating flat shaders I am accessing the _WorldSpaceLightPos0 but it seems like it's returning the wrong values when actually rendering. It looks fine in the scene view, but in the game view it's completely inverted.

    Take for example:
    (scene view)
    upload_2020-5-25_14-52-4.png
    (game view)
    upload_2020-5-25_14-52-35.png
    (frame debugger)
    upload_2020-5-25_14-51-43.png

    This directional light is completely up, making everything pitch black like it should be.
    However on the game screen it's completely opposite, the ground is lit as if the directional light was shining right at it. To make matters worse, in the frame debugger it says that the _MainLightPosition IS pointing down. The same happens with _WorldSpaceLightPos0.

    Does anyone have a clue why this might be happening?
     

    Attached Files: