Search Unity

Help Wanted Lighting forming squares against shader.

Discussion in 'Shaders' started by EthanKessler_Dev, Jun 5, 2021.

  1. EthanKessler_Dev


    Jul 25, 2020
    I'm having an issue with a shader where a light source will form a square that is visible through other meshes regardless of material and the square also shifts with perspective. There is a directional light also present in the scene (causing the shadow), but a directional light doesnt seem to cause the same problem (I'm assuming due to the way a directional light affects all items in the scene). Other light sources also wont cause objects to cast shadows irrespective of material, yet the directional light does.


    The square caused by the light is visible as a patch (as shown below) and is seen even through other objects (as above) without causing shadows or being blocked by objects.
    I'm unsure of how common an issue this is, but as I couldn't find a solution I decided it'd be worth opening a thread. Is it a shader issue? Or have I configured the lighting incorrectly? Any help would be really appreciated.
  2. bgolus


    Dec 7, 2012
    When point and spot lights are rendered in Unity’s built in forward rendering path, Unity limits the screen area being rendered to the rectangular bounds of the light’s range. Normally this is fine, but if you’re using a custom lighting function that doesn’t respect the light’s range you might see artifacts like above. It can also happen with Unity’s own Standard shading model, especially when using materials with a high smoothness.