Chingwa's Guide to Lighting and Post Effects

INTRODUCTION
As a way of introduction this post was inspired by Inquiries found in the “The most insane aaa game…” thread. Specifically posts made by @frosted which can be seen starting around here: https://forum.unity3d.com/threads/the-most-insane-aaa-game-made-in-unity-has-arrived-in-closed-alpha.448514/page-8#post-3073918

Using the example scene that was posted, I took a look on my end and completely re-did all the lighting and effects using my own ideas and preferences, and am collecting the process I went through and some other notes on visual design and technique in order to get the (imho) best starting point in Unity.

Also I should say that this is what I consider a starting point, not the end-all-be-all of lighting in Unity. I’m sure others will chime in with their own thoughts and opinions on this matter which I welcome. I decided to post this as a new thread so that it might reach a bigger audience, instead of being buried in a larger thread.

Also, there is a TLDR at the end if you just want to skip to that. :slight_smile:

DOWNLOAD AND FOLLOW ALONG
I’ve posted the example scene in 4 steps, you can download the project and take a look at each example scene here: http://www.tanukidigital.com/share/LightingTestScene.zip

QUALIFICATIONS(???)
I been-a-usin’ Unity for a long time and I got strong opinions. Also, I used to be a paid artist before I became a bum. Otherwise I have none. Read at your own risk.

LET’S GET STARTED
There are some basic misconceptions that often arise when talking about this subject and that is that some people are talking on a technology implementation level and others are talking on a visual (or art theory) level. Ultimately though everyone has the same goal, which is a kickass image.

The tools you have in Unity to control color are very powerful, and that comes with a lot of responsibility. It’s extremely easy to screw over an image right from the start if you don’t begin from the proper baseline, both on the tech side and the visual theory side.

TECH BASELINE
So let’s start with a perfect baseline that we can use to build on. I downloaded the example project and opened it in Unity 5.6. I deleted all lightmaps and turned off all bake settings including enlighten… this stuff just get’s in the way and “muddy’s the water”, since you have little control over what it’s doing. I converted the one scene light to realtime, set the color to pure white and the intensity to 1. I also set The ambient environment lighting to skybox with an intensity of 1.0 and set the reflection probe to render nothing but the sky (culling mask: none). I set the project to LINEAR color mode in Player Settings, and made sure the camera was on HDR and Deferred, and turned off all fog. Finally I deleted all image effects and Standard Assets from the project and imported Unity’s post-processing stack instead. I enabled only the ‘Color Grading’ section with the Tonemapper set to Neutral, without touching any of the default settings. As an aside, I wrote a little script that force updates the Unity Ambient environment and applied it to the camera, since for some reason it was not updating itself on skybox mode.

The below is the result and is about as basic (yet “proper”) result you can get with Unity. As you can see the results are pretty bland, which is to be expected.

ART THEORY
So let’s get a couple key RULES out of the way right off the bat…

  1. There is no difference between color and lighting. Color IS lighting.
  2. Color is RELATIVE. Always.

Now because of these two rules, we can just make up a third rule that isn’t exactly always true but might as well be…
3) Color is EVERYTHING.

Since color is so important we want to do everything we can to maintain color info and dynamic range in our scene/image. So let’s look at some improvements we can make without immediately jumping to brighten/contrast (which destroys color info) to help this image along.

In general, unless you’re looking directly at the sun, the sky will be the brightest and most important element in an outdoor environment, and it will cast it’s color onto everything in the scene. You can have a completely believable scene in Unity without even using a directional light at all, as long as the object’s are lit properly from the sky. This is why it’s imperative to set the ambient source to be ‘skybox’. I’m going to make up my own rule here… Ambient light is more important than direct light. Believe it.

Now as we said before, the sky is bright. The sky is in fact so bright that sometimes your eye has a hard time reconciling the sky and other objects at the same time. This is even more of an issue in cameras since they can’t capture anywhere near the dynamic range that your eye/brain can understand, and this extends to monitors since they have a limited dynamic range that they can display. This leads to the tendency of adding “Contrast” in an image, which unfortunately usually means darkening the darks and lightening the lights. But since we stated above that color IS light, we can also influence the contrast by changing color instead of destroying the already limited value range in the image.

So let’s make some small tweaks here to give ourselves a more visually cohesive image. We can make the sky APPEAR to be brighter by bleeding it into the other colors in the scene a bit. In the PostProcessing stack I turned on Bloom, kept the intensity at 1, lowered the threshold slightly to 0.95, and adjusted the soft knee to 0.75.

Let’s also add some antialiasing since nothing screams “fake image” quite like jagged edges do. I turned on the postprocessing antialias setting and set it to ‘extreme performance’. Even just a little bit of aliasing goes a long way especially when looking at a static image.

The direct light of the sun is generally extremely bright and extremely white. As the sun get’s lower on the horizon the light rays have to pass through more and more layers of atmosphere, and because of that the blue of the sun light starts to get refracted out, which makes the sun light appear warmer and warmer the lower it gets on the horizon. We can simulate this of course by changing the color of the Directional light. But a little goes a long way! Don’t get overzealous here. The angle of the sun in this scene has started to lower, but it is still well above the horizon and firmly in an mid-afternoon stage. I set it to an rgb of 255,240,200. I also raised the intensity to 1.25, since again, the sun is brighter than anything else in the scene.

We can add further cohesiveness to the image by adding Ambient Occlusion. We want to be careful though, because this can add a lot of “contrast” (erroneously meaning darker darks) to the image where we don’t necessarily want that in the long run. I turned on the AmbientOcclusion in the PostProcessing stack and set the intensity to 1 and the radius to 0.2, kept downsample on and the sample count to medium. And, very important, since we’re using Deferred we can apply the occlusion only to shaded areas by checking ‘ambient only’.

Just these very small tweaks are giving us a much much nicer image. It’s very cohesive, and has sufficient contrast for the image to read visually while still retaining plenty of color info / dynamic range for further tweaking.

ART DIRECTION
It takes a special skill to step away from your work and look at it from a fresh perspective, or a defined perspective. It’s easy to be too close to what you do and not want to sacrifice the work that you made, or work harder to improve what you already think is good. This is why everyone hates art directors, and also why they get paid so much.

So let’s art-direct the crap out of this image. We got this far, it looks good mostly (you think) and you show the art director your proud baby and this is what happens…

“What is this muddy mess? There’s no focus. There’s no contrast. Do it over and show it to me again in an hour, I’m going to lunch.”

Yep. The art director is never wrong, even when they are wrong. As we’ve seen “contrast” is a fluid term that means different things in different contexts, but it almost never means “make everything black”. So how can we improve on this without destroying the dynamic range of our image? Why, by changing color of course!

The buildings and the ground are very similar and they bleed into each other for sure. This might be a realisitic image in our heads or on paper, but it can definitely be made more interesting with a few key choices.

First I added some darkening variance to the ground, it looked like it already wanted to have wet/dry areas, so I darkened up those spots particularly and added a few puddles for visual interest. The ground and the wood of the buildings were particularly close together and were not distinct from each other despite being made of different materials, so I warmed up and darkened the building materials slightly. I also warmed up the straw in the building’s roof… remember how we said color is relative? Adding color is just as good a tool to create contrast as changing value is.

Finally I added some quickly made specular maps where I thought necessary since all the materials were missing them. Remember texture data (like specular) feeds into the lighting/reflection/ambient settings from the rest of the scene and is just as important for lighting cohesiveness as anything else is. It isn’t just for metallics.

Some of the above edits were fairly subtle, but it really brings more dynamic effect to the scene, as well as better ground some elements like the barrels, and bucket.

Looking good. Now let’s go back in and start tweaking some of the more interesting post effects. Chromatic Aberration and Vignette are very useful for simulating subtle falloff. Subtlety here is always key, I added a aberration at only 0.05 intensity, and added vignette at 0.4 intensity and 0.1 smoothness. I also gave the vignette a tint color, since we want to retain color in our scene. Nothing washes out a scene like using black and white when you could be more nuanced. I used an rgb of 34,6,0.

Next I added ScreenSpaceReflection. This definitely adds visual interest to nearby reflections and breaks up large reflected areas such as the puddles. There are a lot of settings here but I made sure to keep the blur low at 1, and increaded the reflection multiplier to 2. For scenes with large bodies of water you’ll really have to experiment with settings here, but these work well for this scene.

To simulate a bit more light in the scene I went back to the bloom and increased the radius from 4 to 4.5, and also increased the intensity of the directional light from 1.25 to 1.4. Now I’m pretty happy with the image as it stands. We have visual interest, good dynamic range, and great contrast while still being able to see everything in the scene.

TLDR
Now you could go on and on like this tweaking effects, changing color grading and etc. forever, but the key points, and perhaps the TLDR is as follows…

  1. Color is everything. Use color instead of contrast. Protect the dynamic range of your scene!

  2. Start with a proper technical baseline for your project. In most cases this means Linear render path, Deferred Rendering, HDR on your camera with Tonemapping, Skybox as ambient, and a Reflection Probe in your scene to capture it.

  3. Practice the art of subtlety. Most settings only need minor tweaking to perform best. (again, protect that dynamic range!)

  4. Break rules where you feel they need breaking.

Another point I would like to make, and this may be just a personal preference, but neutral tonemapping is a better starting point than ACES. You will spend more time with filmic tonemapping trying to get good results because it often hides key base tweaks that should be done prior to messing with it. I recommend doing the steps above under neutral tonemapping, and then perhaps switching to ACES at the end and then tweaking it’s settings from there.

All that is a lot to read, but I hope it helps some people out there, or gives them new ideas about their own projects. Used carefully, Unity gives you pretty much everything you need at this point to get high quality visuals, you just need to be thoughtful and methodical about it.

Note that all this is stock Unity (apart from the PostProcessing stack, which Unity should “just include” in all future downloads, because it’s awesome). Also notice throughout this process I didn’t touch the contrast controls once, not did I touch enlighten (turned that junk off first thing!). While I do think there is a place for GI for sure, enlighten is a mess, and it seems Dynamic GI solutions will eclipse it completely soon enough. This particular scene is not likely to benefit from GI much at all anyway.

OK back to real work now. :smile:

25 Likes

Good read! Nice to see informative posts like this :slight_smile:

I thought your original image looked very good and definitely the last image with all of your enhancements is great. Certainly a noticeable difference. Be interesting to see what @Billy4184 thinks.

1 Like

@chingwa , dude, this is awesome!

I think this is a really good call. I’ve been learning more and more about the details of tone mapping, and the difficulties. I really deeply underestimated (and misunderstood) quite a lot about the process.

Getting a scene organized using a neutral tonemap can really help reduce the number of variables while you put things together and make sure all the parts are in proper order.

Very interesting read, thanks! I’ll probably follow it along in one of my scenes and see how it turns out.

Interesting that you think Enlighten is a mess, can you be more specific?

1 Like

Baking times are restrictive, even prohibitive, on anything other than a relatively small and isolated scene. This right here is a killer in my book. It was sold as a dynamic system and while it technically delivers on that promise it does so at too high a setup cost in fiddling and waiting imho.

Global Illumination is being seen as the latest holy grail in rendering tech, to the detriment of basic visual technique, but I certainly think there are applications for it, and it can add a lot of interesting dynamics to a scene that’s for sure. I know of a few Realtime Dynamic GI systems coming close to completion for Unity, SEGI being the most developed, and I can’t wait for them to become more feasible in games. The advantages of these far outweigh the current and probably future state of Enlighten.

I did say I had strong opinions. :smile:

7 Likes

Frankly I’m a little confused about Enlighten. I’ve been looking at games made with it to see what the best possible quality it can deliver (all else being equal of course).

So, SW:Battlefront, according to Geomerics, uses enlighten for its ‘indirect lighting’ which could mean a lot of things.
Battlefield Hardline, which also uses enlighten, looks pretty poor IMO as blockbuster games go, and is way behind battlefront in rendering quality despite being released only a year or two apart. In fact I think it could easily have made in Unity by an AAA studio.
So it occurs to me that Battlefield 1, which is at least as good looking as Battlefront - in fact it’s probably the best looking game of all time to date - uses the same engine and has a very similar aesthetic and quality despite possibly not using enlighten at all. So I suspect that Battlefront’s rendering quality is not all that much due to Enlighten.

Last but not least, Enlighten’s own demos are not all that great to me. So I’m going to have to say that I think it’s still responsible for most of the ills of Unity’s graphics.

Anyway, not to get too sidetracked. Great information in your guide, and I think this sort of thing has been missing from the community. I’m sure many people will improve their games using it.

2 Likes

SW:Battlefront and Battlefield 1 look so amazing simply because of the designers expert understanding and implementation of PBR technique. This means a combined focus on high quality tuned texture input data and an unparalleled eye for artistic implementation. Enlighten and GI would be decidedly secondary factors in this formula.

I have strong suspicions that GI is a bit of a red herring. I mean, it can be great and all, but it is far from being the main focus for most lighting situations.

3 Likes

Well, just take a look at Battlefield 4 compared to Hardline. Hardline was released two years later and looks way worse - and uses enlighten.

From some of the stuff I’ve read, I think Enlighten is often used to add a dynamic element to a scene that’s otherwise probably baked the traditional way. So I’m not really sure that even games that are supposed to have used it are always using it for anything other than a secondary cosmetic touch. So probably lighting quality (besides correct PBR etc) is still mainly a question of how good the baked lighting is.

Anyway, I’m also very interested in trying out SEGI for future projects, I think that for us indies, getting it performant in a scene would be much easier than it would be for a scene of the complexity that many AAA games have to deal with, so maybe we can use it ‘ahead of its time’ and do something different.

@chingwa

Everyone has there own take on what graphics should look like (unless the goal is pure photorealism), so take this with a pinch of salt… To me there are a fair few fundamental mistakes, you have washout from incorrect bloom setup but it doesn’t pop either… The lighting looks solid and static (aka, a LUT with a properly graded highlight / shadows and midtones correction was really needed (never underestimate the power of the LUT)…

You never mentioned anything about HDRI lighting, those little pixel lights are fundamental to any good looking scene.

Shaders need work, but that’s not your fault… Also I would recommend a hybrid of 2 texel realtime and the progressive mightmapper… Getting the skybox influcence and reflections correct is also an important part of the process (especially for outdoor scenes)…

If you really want to know how to get the best out of lighting, I’d highly recommend people read up as much as possible on Koola.! and other arch viz threads.

4 Likes

Both games have a different art style/direction. ‘Battlefield 4’ aims for realism, while ‘Hardline’ looks more cartoonic(?)/colorful.
Also, both ‘Battlefield 1’ and ‘SW: Battlefront’ uses PBR and Photogrammetry, giving them overall a better graphical look. Those techniques haven’t been used in previous titles.

3 Likes

Understatement of the century.

I think this is the worst demo I have seen.

https://www.youtube.com/watch?v=PCx55V3sXjA

2 Likes

Regardless of the art direction, I think you’ll find that many screenshots show a pretty poor lighting. Even saw a thread about it by gamers where there was a general agreement that it was a step back graphically.

As far as Battlefield 1 and Battlefront are concerned, I think you’re overestimating the impact of PBR and photogrammetry on what makes those games stand out. For one thing PBR is everywhere nowadays, and for another, there are great non-PBR games made with advanced rendering tech that put most modern games to shame, such as Crysis 3 for example which is already half a decade old.

Besides, engines like Brigade show that there’s still a huge impact that lighting can make on its own, so I don’t think we should so quickly dismiss the impact of tech on graphics quality. We don’t really know what’s in Frostbite but I wager there’s a lot of tech going on there besides enlighten.

2 Likes

@Billy4184

Crytek did a breakdown with Ryse between PBR and the old diffuse workflow, there wasn’t masses of difference between the two. It isn’t the secret key to making everything look awesome… Like everything else it’s a small accumulation in the right direction.

But I get the feeling for us, good isn’t good enough LOL!..

2 Likes

It’s look as good as many UE4 scenes, good job.
The only noticeable issue is the default Post Process Bloom, it doesn’t look natural and it’s over exposed on the scene background.

1 Like

@ I was waiting for you to come along :slight_smile: There’s a bunch of stuff I didn’t mention. I only barely hinted at PBR and the importance of texture data, and HDRI lighting would be a very good point as you said. But I don’t think these things are necessary to get great looking lighting in Unity (though I agree they are important for getting THE BEST POSSIBLE lighting out of Unity).

You can get away with a much simpler out-of-the box setup in Unity as long as you start with the proper baseline setup and practice careful conservation over your color range. I see LUTs as helpful sure, but they are things to do at the very end of a grading pipeline and are often overused for glitzy effect.

The stepped breakdown GIF you posted is a) starting from a poor baseline already as they sky is blown out b) get’s no real benefit of the painstaking GI setup (It could have simply used a skybox influenced ambient and a bit of occlusion to the exact same effect) and c) then proceeds to destroy most of the color info in the scene anyway, first with a harsh contrast pass and then an insane LUT.

I have nothing to say about the first video you posted, other than it’s damn gorgeous and I want to live there. You can really see the benefit of GI in a scene like this as it moves over the course of the day.

The second video though, I consider oversaturated and unrealistically harshly contrasted. But I suppose this is where we start to get into visual preferences and how different people are looking for different visual stimulus. I gotta say though, the video looks good on the outset but I wouldn’t want to play a game that’s lit like that… my eyes would get fatigued.

People have a fetish for harshly contrasted images as it fools the brain into thinking it’s seeing a higher dynamic range.

1 Like

How is it over-exposed? If anything I was thinking It’s still a bit under-exposed.

@zenGarden But yes I think that is a silent point I was trying to make as well. If you labelled the final image with the title “Unity assets in Unreal Engine 4!” a lot of people wouldn’t even think twice about it unless they started to look at the details a bit. UE4 gives you this type of starting point by default. But Unity can look just as good with just a few easy to make tweaks.

1 Like

:smile:, I should get a tattoo saying OMG GRFX!..

No, LUT’s are definatley not just for glitz and glamour whilst they can be used for topping off you should be using them to balance shadows and infllct neutrality for your overall image by doing things like whitepoint selection / calibration. Ask the guy who created scion, that awesome dev knows his post (as he gives you some of the options)…

That baseline you are talking about I originally learned as a basis for lightboxing, I’ll put the example I made for another thread below… There is no blowout there, Koola’s example is for internal scenes mainly. I calibrated it to work for both…

HDRI’s / properly calibrated IBL is massively important for uniform lighting, it’s not hard to grab a HDRI image, create a material and slap it on the skybox (then let it bake)… One of the main reasons is GI colour contribution, it can seriously help balancing out a scene and you need variations to simulate how it’d look in real life… That’s why HDRI’s rock.!

Also just to note I agree on the second video, it’s cool as an effect but I agree also I wouldn’t want it constantly in a game:

But yeah, ultimatley you do it how you think is best.

Lightbox:

2 Likes

I’d really like to see this scene (lit like this) in Unity. Not sure if it would be appropriate for this thread but maybe for the other one.

@chingwa regardless of whether or not anyone would spot the difference, I think what you wrote is a very good quick-start guide for setting up lighting in any scene. When there are so many settings that impact eachother it’s good to understand where to begin and what order of steps to take.

2 Likes