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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question 2DLight : Problem with Sprite Custom Lit Shader when no light on camera

Discussion in 'Universal Render Pipeline' started by pentacle703, Oct 11, 2023.

  1. pentacle703

    pentacle703

    Joined:
    Mar 17, 2014
    Posts:
    6
    Hello everyone,

    i'm trying to use the 2D Light from URP for my projet, and I encountered a problem with the Custom Lit Shader I implemented : whenever there is no light in the camera (in fact, no light printed in the light texture), then the texture take a wrong default value or take it from the unity Scene. like the example below :

    upload_2023-10-11_22-21-2.png

    as you can see, the light on the game (bottom screen), is the same than the one in the upper screen, instead of being just dark.
    And if no light from any camera, the scene is just not using any light, and rendering everything bright like below
    upload_2023-10-11_22-25-17.png

    the shader light sampling look like that, the output being just multiplied by the sprite RGB
    upload_2023-10-11_22-27-12.png

    Do you have already encounter this problem and know how to solve it? (I think I may do the sampling wrong)
    Or is it a bug in URP 2D Light?