Search Unity

Question How do you deal with dynamic deferred Point Lights in your city that has day/night cycle?

Discussion in 'General Graphics' started by imDanOush, Aug 2, 2022.

  1. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    Hello,

    Practically, how did you - yourself or your team - actually deal with Point Lights in your city using a dynamic day/night cycle (deferred lights)?

    My project is relatively immense and is for mid-end PC machines. Turning all point lights on drops the fps. So I used a trigger collider to turn the lights on/off. (image below) but this is just looking bad and unprofessional, in my opinion.
    preview.gif
    - Best.
     
  2. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Had my runs with large urban scenes with tons of lights in the built-in deferred renderer. They are "old-school" deferred lights and don't scale well if you have large radius and 100+ of them visible on the view frustum.

    Usually what games do is have assign lights an "importance" value, so some lights are visible at a longer distance than others. Also, instead of outright turning them on and off you fade them in/out by dimming their color based on the camera distance. Keep in mind that doing this for a large number of lights efficiently on the CPU will require some sort of light manager (having several hundreds or thousands of Monobehaviours running Update() can become a bottleneck).

    There isn't much you can do beyond that without resorting to rolling custom rendering solutions, like a custom light probe system which can fade between day and night.
     
    imDanOush likes this.
  3. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    670
    Personally, I didn't have any major performance issues with deferred lights in the built in rendering pipeline. Just make sure that they are not casting shadows. That will kill your performance indeed. Also check the radius of your lights. If they are huge, you will get a ton of overdraw in the light pass.
     
    imDanOush likes this.
  4. imDanOush

    imDanOush

    Joined:
    Oct 12, 2013
    Posts:
    368
    upload_2022-9-1_21-53-49.png

    Thank you for the helpful replies, I had set up the shadows wrongly. Once I made the shadow to be enabled if the player is within a certain range using trigger collisions, effectively the lights do not affect the performance of the game.
     
    c0d3_m0nk3y likes this.