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

Help with point light support

Discussion in 'Shaders' started by no00ob, Aug 9, 2019.

  1. no00ob

    no00ob

    Joined:
    Dec 13, 2017
    Posts:
    65
    I found this asset a while back and tried to implement it into my game but I figured out it was unusable due to being dependent of a directional light but my space game uses one big point light in the middle of the scene as the sun so I tried adding support for point lights to the shader my self, I managed to make it render a strip of the texture on the planets surface but the rest of it is just pure black did I do something wrong?
    Edit: Just realised that it's due to the atmosphere if I turn it off the planet renders absolutely normal meaning that I succeeded, but now the next question why is the atmosphere causing this behavior?
    Edit 2: Seems to be this line responsible for the black planet bug:
    float fLightAngle = dot(_WorldSpaceLightPos0.xyz, v3Pos) / length(v3Pos);

    So how do I make this line functional with a point light?
     

    Attached Files:

    Last edited: Aug 9, 2019