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.

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,046
    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:
    213
    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?
     
    VicktorOti and AdamFoster like this.
  3. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,046
    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
  5. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,046
    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.....
     
  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:

    jeffpenk, filod, Haseeb_BSAA and 10 others like this.
  9. WARW0LF

    WARW0LF

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

    RoyBarina

    Joined:
    Jul 3, 2017
    Posts:
    80
    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:
    37
    Thank you! You have saved my life!
     
    RoyBarina likes this.
  14. Johane

    Johane

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

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    251
    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. jeongsuk7

    jeongsuk7

    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
     
  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:
    105

    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.
     
  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:
    213
    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:
    60
    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:
    528
    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.