Search Unity

Question Is there a proper way to adjust light attenuation / drop off in URP?

Discussion in 'Universal Render Pipeline' started by TzuriTeshuba, Mar 27, 2022.

  1. TzuriTeshuba

    TzuriTeshuba

    Joined:
    Aug 6, 2019
    Posts:
    185
    I have spent days trying to fix an issue I am facing with a spotlight in my URP project. In order to acheive the lighting i want from my flashlight, I must have the light's range set to 500 and the intensity to 10 million! This gives me the lighting I want, except for when the flashlight gets close to surfaces and the lighting is blindingly strong. From my research, it seems the only way to acheive my needs is to adjust the attenuation, which includes editting the Lighting.hlsl file in Universal RP/ShaderLibrary and embedding the package into the project. I imagine there are other solutions, since the process is overly complicated, makes future URP updates difficult, and requires messing with files in the Library folder which Unity recommends never doing. Is there a better way of adjusting the light drop off? The extreme spotlight values I am using causes the (mostly desired) effect I acheive within the editor to vanish in my android build, where the lighting drops off abruptly (within the same surface/triangle) and does not even reach the signified distance (makes it less than 10 units).
    (The problem remains when replacing the spotlight with a point light as well.)

    Thanks so much for any insight on the matter, really driving me nuts
     
    Larsson24 likes this.
  2. mat108

    mat108

    Joined:
    Aug 24, 2018
    Posts:
    133
    Ugly lighting with a horrendous attenuation curve is a built in URP feature. Praise Unity.