I feel like I'm missing something that's fundamental when it comes to lighting

Hi!
I have been working with Unity for a while now. Currently I’m working on a game with a big city, but I’m running into some serious problems regarding lighting. I really hope someone can shed some light on this (pun not intended) for me. I just feel like I’m missing something fundamentally about the way people make games in Unity and use lights.

The city in my game is always in night time, so lighting is extremely important, but I’ve never found an approach that actually works for me. There’s always some problem.

  • I tried using pre-calculated real-time lighting. But the baking is extremely slow (because the city is quite big, I guess) and the quality of the lighting coming from emissive materials is atrocious.
  • I tried using baked lights. The biggest problem is the impact that has on the file size of my game. I have done most of the undetailed exteriors and almost nothing of the interior places in my city, and the file size of my game is already 5GB! Quality of the emissive materials is also really bad, just like with real-time lighting. On top of it all, the baked lights are static and can’t be changed at runtime.
  • I tried disabling both baked and real-time lighting. That way only the “real” lights affect the scene, and not emissive materials on objects. I could be kind of ok with that, but the amount of lights you can have on the screen at the same time is extremely limited and causes performance problems.

Is this just the way it is and there is no way to make a nice-looking game in Unity, or am I just completely missing something? Hopefully it’s the latter, since I have seen nice-looking games made in Unity before.
Look at a game like Cities: Skylines for example. That game was made in Unity, and it is possible to put down thousands of lights without a problem. Those lights aren’t baked either. C:S is maybe a bit extreme, but there are so many games with more than just 8 lights visible on the screen at the same time.
I’d greatly appreciate it if someone could explain more about this for me. Thanks in advance!

You should look into using deferred rendering. Cities : Skylines used the legacy pre-pass rendering path, but they both have a similar benefit in rendering large numbers of lights is much cheaper.

However I suspect C:S uses far fewer lights than you think. It looks like they’re using dynamic lights for street lamps and some street level lights on the front of buildings, but everything above the street level is likely faked with per building light maps, most likely baked out externally from Unity and applied using a custom shader, and unlit / emissive windows. It’s more than 8 for sure, but that’s the benefit of pre-pass or deferred lighting over traditional forward.

1 Like

I know this isn’t answering you question, but could you share some more details on what you’re trying to achieve? At least what genre game are you doing? Many genres have developed unique techniques for dealing with performance issues, and I think it is a good idea to classify your game so you can tap into the experience that other games of same genre have.

About the game size - 5Gb shouldn’t be a problem as long as you manage things gracefully. Today most games are at least 15Gb. If you believe your final product can squeeze into that figure, then go for it, and don’t even worry. If you are bothered by long calculation times for your city, perhaps you can break it into chunks of reasonable size, and work on them separately.

If your city is always in the dark, streetlights are great candidates for light baking, but then again I don’t know if you plan on destroying them or something…