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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Making Street Lights Less Expensive

Discussion in 'Editor & General Support' started by Hawk0077, Dec 1, 2018.

  1. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Hi, I have large scene with a lot of street lights... see image below.

    lights.png

    The scene runs at approx 40 FPS but that drops significantly when the street lights turn on at night. To 16ish and less.

    My lighting settings are:

    lights-2.PNG
    lights-3.PNG

    Each of the streetlights has the following settings. The Lamppost has a Spot light attached as well as a script that Enviro uses to turn lights on/off. Here are the settings of each spotlight:

    lights-4.PNG

    Render Path in Project Settings is Deferred.

    I haven't done a Realtime Generate as yet.

    What can I do apart from remove lights to get the project to run with less of and FPS drop when lights come on?

    Any assistance appreciated. Thanks
     
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,900
    You will need to forget the real-time lights in this number. It's too many. You will need to switch to area lights or emissive material and bake lightmaps. You can bake more than one and switch it according to the changing environment but be prepared that it won't work every time (visually) because the day-night cycle and the weather changes are too many combinations.

    If you don't want to sacrifice the quality, you will need to build a system, where a couple of the closest lights are real time lights the other ones are fake. You haven't stated what rendering are you using, so I will leave the research up to you.
     
    Hawk0077 likes this.
  3. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Thanks for the response, I have read up on the various light types etc but it all makes no sense to how it actually all works so seems this is way beyond my understanding. Unfortunately your response doesn't really help me much as I was looking for a "how" answer to be honest... but thanks anyway. Much appreciated.
     
  4. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Looks like you kicked me into a heavy study session or two. Thanks for that.
     
    Lurking-Ninja likes this.
  5. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,900
    That was my intention. :D You'll be better off when you're done, next time you'll know what to do in similar situation.
     
    Hawk0077 likes this.
  6. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Hi, not sure if your still following this but I think I get the idea.

    In the image below I added an Area Light (disc) to a lamppost and then created a Lamp/bulb for the actual light with an emission material.

    Not When I eventually bake the whole scene I can use Enviro to change the emission texture at night to switch the lights on and then to change the material to switch the lights off in the morning.

    Problem I'm having getting my head around is changing the road and terrain textures at day and night.

    Normally I would have a NightLights.cs script attached to the Street light that activated and deactivated the lights on the object lampposts... in this case area lights. And so my question would be would this also change the textures to use the light maps created at bake time? ie when the Area lights were deactivated and reactivated through the script?

    On the demo below deactivating the light works fine but each time the lights are baked which wont be possible with the end result. Can you enlighten me as I have seen nothing in my search to get this far.

    Heres the demo I created of a working light. Just needs a bit of bloom in the post processing when I addd that.

    lights.png

    Thanks again.