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. Dismiss Notice

How do I increase point light range without changing intensity?

Discussion in 'Universal Render Pipeline' started by bh4786, Apr 29, 2021.

  1. bh4786

    bh4786

    Joined:
    May 24, 2017
    Posts:
    13
    I am trying to get this lantern to shine light at a greater distance but with URP, you can't just increase the range. If I increase intensity, closer objects are completely overexposed/blown-out. Is there any workaround to this that doesn't involve scaling everything down?
     
  2. xgonzal2

    xgonzal2

    Joined:
    Jul 3, 2012
    Posts:
    62
    I think this is a side effect of the more physically accurate light attenuation function used in URP and currently there is no way to change that without changing shader source code. I know there were other forum posts discussing the same thing and some even provided the changes they made to the attenuation function.
     
  3. bh4786

    bh4786

    Joined:
    May 24, 2017
    Posts:
    13
    I have seen that fix and tried it but it seems like they have changed the Lighting.hlsl since that was posted because I cannot find the line they are talking about.
     
  4. xgonzal2

    xgonzal2

    Joined:
    Jul 3, 2012
    Posts:
    62
    Unity added a new shader header called RealtimeLights.hlsl in the very latest URP versions. In there you can find the distance attenuation function you would need to change.
     
  5. bh4786

    bh4786

    Joined:
    May 24, 2017
    Posts:
    13
    How would I add that to my project? Can I just bring in that file or do I have to use an entirely local copy of URP?
     
  6. xgonzal2

    xgonzal2

    Joined:
    Jul 3, 2012
    Posts:
    62
    To modify any package source code you have to first embed the package in the project. That means copying the package to a folder like Packages and then add it through the package manager as a local package. After that you can modify the source and keep the changes in the project.

    On URP 10 you should still find the distance attenuation function inside the Lighting.hlsl file. I think it's a very recent thing that Unity added that new shader file I mentioned, in which case, that's where you would find the distance attenuation function.
     
  7. bh4786

    bh4786

    Joined:
    May 24, 2017
    Posts:
    13
    Ah I found it, it does seem to be in the RealtimeLights.hlsl file. Thanks!
     
  8. bh4786

    bh4786

    Joined:
    May 24, 2017
    Posts:
    13
    Where do I download the URP package locally?
     
  9. xgonzal2

    xgonzal2

    Joined:
    Jul 3, 2012
    Posts:
    62
    You could copy the URP package that would already be downloaded in your Package cache folder and then move that over to the project you are working on. Then add it to the project through the package manager window's option to load local packages. If your project is already setup with URP then you'll have to remove that first and then add the local copy so the project manifest is setup correctly. Otherwise the package manager documentation has several other ways you can setup an embedded package.
     
  10. bh4786

    bh4786

    Joined:
    May 24, 2017
    Posts:
    13
    Cool I figured it all out, got the light working as intended now! Thanks for your help.
     
    xgonzal2 likes this.