Search Unity

Resolved Pointlight and Spotlight stopped working in my project ! (URP)

Discussion in 'Global Illumination' started by mfatihbarut, Jun 15, 2021.

  1. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    Hi all,
    The only light working in my project is direct light and no matter what I tried I couldn't achieve to let my point and spotlights (in Realtime mode) work.
    What is happening?
     
  2. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Hey there,

    Which shader are you using on the problematic surfaces?

    Are the ranges of your point/spot light sufficiently large?

    Could you perhaps post some screenshots illustrating your issue?
     
  3. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    I use simple Lit shader.

    As far as I see there is no problem with point light's range or intensity

    And about the screenshot it is just dark :)
     
  4. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    ahmodmyd likes this.
  5. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    I refactored the whole project from the URP template and it solved the problem. But thing is, that is a very tiring job even at the initial stages. I am afraid if I have to do it at later stages...
     
  6. Mat_Cyber

    Mat_Cyber

    Joined:
    Apr 14, 2020
    Posts:
    8
    Hey,

    I know this thread is kinda old but still if at any time that lights stop working u can go to the unity preference tab and clear all the cache....it worked for me when the lights in my editor weren't visible

    By the way I was using URP, but I guess this might also work with the other render pipelines.....
     
    lukasz13, honor0102, kloogens and 8 others like this.
  7. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    OMG you saved me and the funny thing is that you posted it today! First time tbh xd

    Thanks!
     
    Tset_Tsyung likes this.
  8. Ahmedsiddique

    Ahmedsiddique

    Joined:
    Feb 16, 2018
    Posts:
    2
    Ok people if some one still has issues please go to your project settings > graphics click the render pipe line you are using and in inspector of URP- settings Go to Lighting > And check Additional lighting if its disabled or not if it is disabled go for per pixel etc. please check the image
     

    Attached Files:

  9. WARW0LF

    WARW0LF

    Joined:
    Oct 1, 2016
    Posts:
    16
    Thanks, i totally forgot there was settings there, saved me a headache
     
  10. RoyBarina

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    98
    I have noticed one of my point lights within a specific prefab didn't work entirely no matter its settings, but when I added a new point light at the same position with the same exact settings, the new point light worked as it should.
    So I just needed to "replace" that faulty light with a new one..
     
  11. Tegraze

    Tegraze

    Joined:
    Oct 1, 2018
    Posts:
    1
    I'm currently having the same problem.. I'm close to giving up on this... Directional lights stil work, but things light torches (point light) and flashlight (spot light) doesn't work

    Edit: Apparently, it only happens on "low settings" URP
     
    Last edited: Jun 18, 2022
  12. TheQiwiBoy

    TheQiwiBoy

    Joined:
    Dec 19, 2019
    Posts:
    2
    Thank you so much! This really helped!
     
  13. socialtrens

    socialtrens

    Joined:
    Oct 23, 2017
    Posts:
    65
    Thank you! You have saved my life!
     
    RoyBarina likes this.
  14. Johane

    Johane

    Joined:
    Jan 30, 2016
    Posts:
    19
    It works for me if I just duplicate the "faulty" light. It's long tho... would be good to understand why this is happening...
     
    lukasz13 likes this.
  15. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    256
    anyone found the fix for that retarded problem that shouldnt exist in the first place?
     
    DBarlok and RoyBarina like this.
  16. cococamo919

    cococamo919

    Joined:
    Jul 23, 2021
    Posts:
    2
    I am have issue still any one on one help would help a lot.
     
  17. eunyeong_ch

    eunyeong_ch

    Joined:
    Apr 20, 2022
    Posts:
    2
    I cleared GI Cache and the started working. But unfortunately it isn't working in the runtime and build. I've tried it many times, it gives the same issue. Does anyone know the solution for this?
     
  18. jgvidottora

    jgvidottora

    Joined:
    Feb 13, 2017
    Posts:
    2
    Im using unity 2021.3.16f1 and I'm still having this issue with point lights and spot lights, my spot light that acts like a flashlight overrides all of the point lights in my scene, I already cleared the cache and I'm using additional Lights with Per Pixel, I also tried to change the per object limit to 8 and still it doesn't help.
    upload_2023-3-16_13-55-53.png
    this is my spot light config, and I have 10 point lights all over the scene with this config:
    upload_2023-3-16_13-57-3.png
    the point lights are really far from the spot light, and it seems like all of my point lights is acting like my spot light:
    upload_2023-3-16_13-59-44.png
     
  19. jgvidottora

    jgvidottora

    Joined:
    Feb 13, 2017
    Posts:
    2
    I found that the solution is to set the "Universal Renderer Data" to use Rendering Path as Deferred
     
    zozdemir886 and donek1 like this.
  20. Hazzel

    Hazzel

    Joined:
    Feb 26, 2022
    Posts:
    14
    nothing works for me, trying to enable 3d light in a 2d template with all the steps above, trying to switch, does not work
     
  21. kloogens

    kloogens

    Joined:
    Jul 1, 2015
    Posts:
    116

    Last night my project worked fine.

    When I open it up this morning all the lights in the scene just stopped working. If I added a new light it was fine but all the old lights didn't do anything. I could change settings, intensity range, whatever, but nothing would happen.

    Your answer worked.

    Thank you.

    I wish Unity would fix these kinds of things, I'm spending about 30% of my average day searching the internet trying to find answers to these types of problems that shouldn't exist, literally years after they've been discovered.

    My patience is wearing thin.
     
    bluescreen512 and CalBPG like this.
  22. ngduykhanh

    ngduykhanh

    Joined:
    Mar 14, 2018
    Posts:
    5
    BINGO!
     
  23. efeferrari

    efeferrari

    Joined:
    Aug 26, 2021
    Posts:
    1
    I tried this and it worked fine. Thank you.
     
  24. unity_CgFzdvU23j_bcg

    unity_CgFzdvU23j_bcg

    Joined:
    Sep 2, 2021
    Posts:
    4
    I seem to have found a possible cause for this issue where point lights stop working:
    This has been reproducable for me by generating a baked lightmap with Lighting Mode: Subtractive.
    Initial Setup (image 1):
    1 cube that is marked as static (the left cube)
    1 cube that is not marked as static (the right cube)
    a point light with Mode: Mixed
    Initial Setup.png
    After Baking (image 2):
    The static cube has the same lighting as before, just now from the lightmap instead of the point light
    The non-static cube no longer receives any lighting from the point light
    At this point the point light could be deleted and nothing would change
    After Baking.png After adding a new point light (image 3):
    Either an entirely new one or by deleting then Ctrl+z -ing the existing point light
    The static cube now receives a double dose of lighting while the non-static one is back the to same state as image 1.
    Note: using Ctrl+z to "reactivate" the broken point light will only work until the scene is reloaded.
    After Replacing Point Light.png
    Clearing the GI cache, unsetting the Lighting Data Asset in the Baked Lightmaps tab of the Lighting window or clearing baked data all have the same effect of bringing the scene back to the state of image 1.
    For me personally using deferred rendering mode is not an option as it seems to be incompatible with one of the other shaders used in the project.
    Overall the description of Subtractive Lighting mode does not seem to match the results.
    Is there any way to actually have mixed lights light up static objects with baked lightmaps and dynamic objects with realtime lighting?

    Using Unity version 2021.3.11.f1 and URP version 12.1.7
     
  25. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    Hey. This seems like a valid bug to me. I suggest filing a bug a report for it.

    Just to make sure, is your pixel light limit set appropriately? (https://forum.unity.com/threads/lightmapping-troubleshooting-guide.1340936/#post-8466968)
     
  26. unity_CgFzdvU23j_bcg

    unity_CgFzdvU23j_bcg

    Joined:
    Sep 2, 2021
    Posts:
    4
    As a follow-up regarding pixel/vertex lights:
    The limit for pixel lights was set to maximum (which seems to be 8)
    I made a new setup with a giant cube and 3 rows of 9 point lights each for a total of 27.
    The lighting on the cube in image 1 clearly shows which 8 lights are pixel lights with the rest being converted to vertex lights. The strange thing is that the inserted Unity-Chan models and the Spheres also receive lighting from vertex lights, while the cube does not receive any lighting from vertex lights.
    LightsOn.png Image 2 is just here to show the difference to the scene with no lights.
    LightsOff.png
    Is it possible that vertex point lights do nothing on flat surfaces as their meshes wouldn't exactly have a lot of vertices to light up?

    Note that all of this combined puts me in front of a seemingly unsolvable problem:

    Initial problem:
    My scene is that of a small village an night with a variety of lanterns/torches/candles which exceeds that 8 pixel lights limit causing the ground terrain (a lot of which is entirely flat) to not be lit up correctly.

    The terrain is static so i thought i could use baked lightmaps to circumvent the problem, however as explained in my last post this seems to break the point lights. Duplicating all of the lights each time after i bake a lightmap is very tedious and has the undesirable side effect of doubling up on lighting whenever the replacement light is treated as pixel light. (This might be solvable by setting all point lights to Not Important).
    Unfortunately there is no guarantee that all flat surfaces in the future will be static so this is a temporary solution at best.

    Using deferred rendering mode instead of forward rendering solves the lighting issue but it does not seem to be compatible with a custom grass shader/material used in the project.
    The shader was not written by me and my own knowledge of writing shaders is extremely limited so i dont think i can resolve this in a resonable amount of time.

    Perhaps i could try adjusting the terrain to be slightly bumpy and see if that allows vertex lights to provide good results.
    Is there a way i can apply some sort of "noise" to the height of an existing terrain?
     
  27. icauroboros

    icauroboros

    Joined:
    Apr 30, 2021
    Posts:
    165
    This was happened me, then disabling "use rendering layers" on URP asset fixed the issue. idk if its related
     
  28. unity_CgFzdvU23j_bcg

    unity_CgFzdvU23j_bcg

    Joined:
    Sep 2, 2021
    Posts:
    4
    This seems to be a feature added in URP 14. The project i am working on is using URP 12 so this is definitely not the issue in my case
     
  29. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    767
    Vertex lights do lighting calculation per vertex. You can try placing vertex lights near the plane's vertices.

    You need to subdivide the terrian to have more vertices, which can be bad for performance depending on how dense the vertices on terrian will be.

    You can force Forward rendering if changing the LightMode in shader from "UniversalForward" to "UniversalForwardOnly". ("DepthNormals" to "DepthNormalsOnly" if there's one)

    ForwardOnly objects still have 8 lights limitation per object in Deferred rendering path, but I think it's acceptable because grasses are small objects.
     
  30. unity_CgFzdvU23j_bcg

    unity_CgFzdvU23j_bcg

    Joined:
    Sep 2, 2021
    Posts:
    4
    Tried this and it works without any problems so far. This solution is definitely preferable to anything I could come up with on my own. Thank you very much!
     
    wwWwwwW1 likes this.
  31. Vincent321

    Vincent321

    Joined:
    Jul 18, 2018
    Posts:
    1
    works, thx
     
  32. asnyder28

    asnyder28

    Joined:
    Feb 3, 2023
    Posts:
    1
    What if you've tried everything that everyone here has suggested and are still having this issue? I'm willing to try anything. I updated Unity from a 2020 version to the latest 2023 version. I have other projects where lighting works just fine and I've compared the various lighting and URP settings and I can't find anything that makes a difference. I'm starting to conclude I just need to start from scratch in a new project just so I can get realtime lighting. If anyone has anymore suggestions please let me hear them. Thanks
     
  33. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    Did you check URP settings for "Dont use secondary lights" or something like that which disables all the lights except the first Directional light.
     
  34. ertbaran

    ertbaran

    Joined:
    Feb 22, 2019
    Posts:
    11
    When I change my Spot Light Intensity from 15 to 300 it started to work :)

    Directional Light still works with same intensity, same effect. But Spot Light and Point Light different.
     
  35. lukasz13

    lukasz13

    Joined:
    Jul 10, 2017
    Posts:
    7
    Thanks for the hint. It was the only solution that worked for me.
     
  36. aleksef

    aleksef

    Joined:
    Sep 28, 2019
    Posts:
    1
    In my case the problem was in URP Asset settings. Additional lights were disabled and "Per Object Limit" was set to 0. So I turned them on and set the limit to 2. The problem was solved.
     

    Attached Files:

  37. LeoSelva

    LeoSelva

    Joined:
    Jun 21, 2022
    Posts:
    1
    Hi all,

    It seems like there are alot of different ways this issue could come about. Total noob here, only been working with Unity for about a year, but for me, I found that for some reason the project settings > graphics > scriptable render pipeline was set to URP High Fidelity, however in project settings > quality, was set to performant (performance mode), which uses URP-Performant Asset which by default disables secondary lighting. Changing the quality to the "balanced" or "High Fidelity" option, or changing the URP asset to URP-Balanced or URP-High Fidelity asset, fixed my issue. I guess this is to say to make sure you are pointing to the same URP-Pipeline in both the graphics portion of your project settings and the quality section of your project settings. Hope this helps!
    Screenshot 2024-01-18 at 4.47.20 PM.png Screenshot 2024-01-18 at 4.47.59 PM.png
     
    chariin likes this.
  38. jamespaterson

    jamespaterson

    Joined:
    Jun 19, 2018
    Posts:
    399
    I had the same problem in Unity 2022.2.0b16.112.5806.
    Issue for me was enabling "Use Rendering Layers" which supposedly allows you to selectively control which objects get lit but in practise seems to break all lighting except the main directional light. :(

    Correction: changing to deferrer rendering from Forward+ possibly fixes. But rendering layers for lighting control seems pretty buggy

    further info: supposedly later versions of unity 2022 fix this issue. I'll have a look tomorrow
     
    Last edited: Feb 8, 2024
    MatosEncoreMatos likes this.
  39. Daniel_Triangle

    Daniel_Triangle

    Joined:
    Apr 7, 2022
    Posts:
    3
    This was the actual fix thank you
     
  40. NCTM

    NCTM

    Joined:
    Apr 24, 2017
    Posts:
    1
    I don't find the "Additional lightning" checkbox. Could you please post a screenshot? Thank you!