Cities: Skylines

Cities: Skylines

62 ratings
Detailed window illumination methods, modest tips and tricks!
By Whipplesnoodle
An illustrated guide for detailed nightly window illumination for asset creators, detailing a workflow for quick and effective results.

I explain some of the basics of the random illumination system, providing the basics, some tips, tricks and dandy gifs!
   
Award
Favorite
Favorited
Unfavorite
At level 5, when 90% of your city is windows...
...the issue becomes real.

Plain, flatly lit windows are not the prettiest thing in Cities: Skylines (CSL). Given, with the right cross framing it is very much possible to make it look realistic, but sometimes a more appropriate route to realism is the use of detailed window textures in the illumination file.

We all know that at night CSL uses a random illumination algorithm, using greyscale values from assets' illumination maps in the range of 128 to 255. This is subdivided into two independently fluctuating ranges of 128-191 and 193-255. 192 never lights up, and needs to be used for dark areas on randomly illuminated UV's, as opposed to value 0 for permanently illuminated UV's.

With this information and an image manipulation program (that probably gives away that I use GIMP) you can create a large variety of detail for your asset's nightly windows.


I'm not sure who was the first person to use detailed night lights, so I'll just give all the credit to Cool_Z who posted his tutorial [community.simtropolis.com] on simtropolis when after dark was just live!
A simple 192-255 greyscale.
Of course the first step is to find an image on the web. I usually use http://www.textures.com, but they don't have nightly offices with a lot of stuff inside. Thus I simply used google. Search terms akin to "office at night" should do the trick.
I found this:


IMG 1. The image I borrowed from google.

Once loaded into photoshop/gimp or any other image handling program (preferably one that works with layers), convert the image to greyscale:



IMG 2. The image changed to greyscale.

Then there are a few options. The simplest is to adjust the value range (GIMP: Colors > Levels) to 192-255. This creates a very quick and satisfactory result. Make sure that areas you do not want to light up are quite black, if need be, tweak the brightness/contrast a little bit!


IMG 3. 192-255 window textures on a 192 background.


IMG 4. Sped up gif showing the resulting illumination cycle.


Two little things bother me about this:
  1. The whole thing lights up at the same time.
  2. Stuff lights up very slowly, little by little, and generally everything pulses at the same time.

Naturally you can break it up a bit by replacing some windows with flat 192 rectangles, but these issues will remain.
A 192-128 complementary greyscale.
So, to alleviate my first point, a little bit of variation is necessary. We do of course have not only one, but TWO ranges at our disposal. So, like we did with 192-255 above, we can also do with 128-192. One little issue is that values 128 and 255 light up first and most often, and 191 and 193 last and least. 192 remains dark at all times:


IMG 5. Sped up GIF animation showing the symmetricity and variation between the 128-192 and 192-255 value range cycles.


IMG 6. The illumination map used to produce IMG 5. Greyscale values are indicated.

Because we need consistency in the areas that are lit, and most importantly in the ones that are never lit (192), we need to invert our range to 192-128. Otherwise areas that are supposed to correspond to 192 would light up first.

So, repeating the previous steps:


IMG 7. Greyscale windows in range 192-128 on a 192 value background.

This will behave almost exactly like our previous product, with the exception that these windows will light up according to a different random timer as seen in IMG 5.
If you are willing to accept my second issue (or happen to like the effect it produces!), using a combination of these two is good enough variation for smaller assets with a couple dozen windows. Feel free to copy-paste groups of windows to mix them up a bit!

If you are like me though, you will never be happy with your own work. Which means there is more to do: the following is a method that allows for a whole ton of lighting variation, mostly dependent on how much time, and especially texture space, you have left to dedicate.


Using alpha channel for freedom!
Go back to the early steps where you just greyscaled your image:


IMG 2.

You may want to reduce brightness or up the contrast to the point that everything that you do not want to light up is black.Then change black to alpha (GIMP: Colors > Color to Alpha > pick black):


IMG 8. Before and after replacing black with an alpha channel.

Now create a background layer and fill it with 192 grey. Together with your windows this should look very similar to IMG 3. If the windows look a bit pale because you changed the brightness just now, don't worry! You can now alter the values of each seperate window without having to worry about keeping one end of your value range to 192! Simply select single windows, or groups of windows from the window layer, go to Colors > Levels (in GIMP), and change their upper value to anything! Because of the alpha channel they will always smoothly fade to the background value of 192 where they should.


IMG 9, 10. Selection of a group of windows with it's value changed to 145. Left: With background layer visible. Right: Without background layer visible.

After some further playing around changing values and removing some windows that you never want to light up you can end up with something like this:

IMG 11. A section of the finished window illumination map.
An overview.
As an overview, here is a file with examples from all methods:


IMG 12. Top left: Simple greyscale, values 192-255. Top right: Simple greyscale, values 192-128. Bottom: Result using alpha map with background layer.



IMG 13. Sped-up GIF of the the in-game result of the above illumination map.

Each top quarter lights up uniformly. This method works well as a time saver on buildings with only a few windows. The bottom half is much more varied, some windows only light up briefly, where others stay lit for longer. This works better on larger glass towers.

It turns out to look a lot better in the game, the speed of the cycle in these GIFs makes patterns a lot more obvious and the whole look a lot less realistic.
And just this...
Some quick tips:
  1. Values closer to the extremes will light up more often and for longer than values closer to 192. Values closer to the extremes will also light more gradually, where ones closer to 192 will fully illuminate and darken more rapidly.
  2. If you use repetitions of windows, try mirroring some groups so they look slightly different.
  3. If you use some blurry shadows cast on your windows instead of sharp and detailed people, office equipment, blinds or plants etc., it is often possible to flip groups of windows without it looking weird, creating more apparent variation.



I hope this was helpful, and if not, then it was at least fun to make! Thanks for reading! :D

4 Comments
tony_r_68 (Zed68) 26 Sep, 2016 @ 8:27am 
Hehehe, nice tutorial ;) ;)
Yep, I was the first to use this technique, thanks for the credit and for the link to my first tutorial. I wish more builders used this (and CO had used it too for their own buildings. I remade one that they forgot to give nightlights to but I wish we could remake them all).
Rick Marcel 16 May, 2016 @ 2:17pm 
Nice :)
charlesnew 14 May, 2016 @ 8:47pm 
Thank you! I've been wondering how exactly I could do this, but never really got on with experimenting.
Quad Rioters 10 May, 2016 @ 6:33am 
This is awesome! :steamhappy: I never use 128-191 ever and it's about to change.