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

Resolved Multiple Spotlights: One spotlight is turning off when the other is pointing at same object.

Discussion in 'Universal Render Pipeline' started by Akura, Mar 5, 2023.

  1. Akura

    Akura

    Joined:
    Jun 28, 2015
    Posts:
    23
    Hi im using Unity 2021.3.18f1 with a URP Template for a VR Project (Oculus Quest2).

    The problem:
    Everything works well as long as the fireplace spotlight is disabled.
    When i turn on the fireplace spotlight and point the flashlight towards the fireplace, the spotlight of the fireplace is turned off.

    What i have:
    I have 2 objects, a flashlight and a fireplace. Both have 1 spotlight.

    Demonstration:


    What i've tried:
    I have tried to work with different 'Render Mode' Settings (Auto/Important) which didn't helped.
    I have read that there is and option in 'Edit > ProjectSettings > Quality' which lets you upping the pixel light count. Unfortunatetly i couldn't find this option in my unity version. So i tried it per code which also doesn't helped:

    Code (CSharp):
    1.   QualitySettings.pixelLightCount = 12;
    The Lightcomponents:

    Fireplace:
    upload_2023-3-5_16-58-58.png

    Flashlight:
    upload_2023-3-5_17-5-34.png
     
  2. Liam2349

    Liam2349

    Joined:
    Mar 10, 2016
    Posts:
    78
    It looks like you are running into the per-object light limit under the Forward renderer. I think this could be as low as 4 lights per object on mobile, I can't find the info on this. A quick way to test would be to switch to Deferred rendering, in your Universal Renderer Data.
     
  3. Akura

    Akura

    Joined:
    Jun 28, 2015
    Posts:
    23
    Then the question is how much does this impact the performance when switching to deffered rendering? I will give it a try after work and let you know. Du you know by any chance where i find the Universal Renderer Data?
     
  4. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    761
    Hi, you can have at most 8 lights per object when using Forward rendering path in URP.

    That's for Built-in RP. You can find the pixel light limits in the URP asset.
    URP_Asset.jpg

    I don't suggest switching to deferred path on Oculus Quest2 unless you can reduce the Render Scale. But you can always try and see if the performance is acceptable.

    Note: Deferred path in URP doesn't support OpenGL backend, it'll fallback to Forward.

    You can try the new Forward+ path to have more real-time lights in the scene once VR support is done.
    Forward+: no per object light limitation, but at most 32/16 per camera on mobile using Vulkan/GL ES 3.0
    You can find the rendering path options in the (active) URP renderer.
    URP_Asset.jpg
     

    Attached Files:

    Last edited: Mar 6, 2023
  5. Akura

    Akura

    Joined:
    Jun 28, 2015
    Posts:
    23
    Thanks for your answer! I will give it a try when im at home and let you know.
     
    wwWwwwW1 likes this.
  6. Akura

    Akura

    Joined:
    Jun 28, 2015
    Posts:
    23
    Perfect! I just adjusted the "Per Object Limit" from 1 to 2 and everything works! Thank you very much!
     
    wwWwwwW1 likes this.