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

Question The light in urp is overexposed up close.How to fix it?

Discussion in 'Global Illumination' started by Danila_Navaev, Jan 4, 2023.

  1. Danila_Navaev

    Danila_Navaev

    Joined:
    Apr 25, 2022
    Posts:
    7
    I tried to make a flashlight in unity with urp, but I found out that when the light source approached any mesh, the mesh turned out to be too overexposed
    , and too underexposed when moving away.
    How to fix it?
    P.S. There was no such thing in standard rp.
     

    Attached Files:

    Last edited: Jan 4, 2023
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,549
    The only suggestion I've seen has been "use Linear color space", but that didn't fix it for me. Some related threads..
    https://forum.unity.com/threads/point-light-becomes-way-too-bright-when-i-switch-to-urp.778301/
    https://forum.unity.com/threads/spot-light-intensity-issue.969021/

    The approach I've found that does work (..maybe someone has a simpler solution) requires editing URP itself and customizing the DistanceAttenuation function in URP package Shader Library/RealtimeLights.hlsl. But if you're going that route, make sure you copy that package to somewhere outside your project first, then import that copy in Package Manager, then edit that copy - because if you edit the file directly as-is, it will end up overwritten/reverted. Also, you will have to repeat this process if you want to update URP.
     
    Danila_Navaev likes this.
  3. Danila_Navaev

    Danila_Navaev

    Joined:
    Apr 25, 2022
    Posts:
    7
    Thank you very much I will try this.
     
    adamgolden likes this.
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    For the record, there is no need to "Fix" this in theory, since this kind of fall-off attenuation is "realistic" and if you don't like how blown out the highlights are getting, you are supposed to adjust your tone mapping so they don't get so easily blown out.