Unity Post-Processing Stack Intro

Last year Unity released the Adam demo, and it looked amazing! Check it out below in case you missed it:

It turns out that anyone can harness the improvements that they used in the demo. The Unity team released 3 asset packs from the demo:

Adam Character
Exterior Environment
Interior Environment (with new volumetric lights!)
Post-Processing Stack

That last one is what we’ll look at today. The Post Processing Stack essentially replaces all of the standard asset image effects that used to get dropped onto the cameras individually. This new system is (in my very humble opinion) much nicer looking, faster, and way easier to work with.

The stack offers more accurate shading effects and it takes care of applying them in the right order. I’m going to walk you through how I apply my PPS behaviors (that’s part of the new stack!).

In essence, you add a post processing behavior script to the camera, drop a behavior onto the script, and tweak the behavior through the project view.

1. Download and Install

A Unity Asset Store search page
Search for ‘Post’ or ‘Stack’ on the Asset Store, it will be one of the first results.
The Post Processing Stack asset page
Click ‘Download’, ‘Install’ and wait for it to unpack. When the window with checkboxes comes up click ‘Install’.

2. Camera Setup

A unity camera inspector with several post-proccesing scripts.
Here is a camera with all the scripts that the Stack replaces. If you have them on a camera either remove or uncheck the individual effects.
The inspector on a unity camera with the post-proccesign Behaviour added.
Add the Post-Processing Behaviour Script by searching in ‘Add Component.’
A new Post-proccesing Behaviour File
Right click in the project window and select ‘Create’ > ‘Post-Processing Behaviour.’ Name it as you would like, I have named mine ‘PetraNice’ since I’m working on a Petra-themed project.
The Post-Prccesign script on the camera, with the behaviour dragged in.
Drag your new behaviour into the script on your camera.

3. Setup your behaviour

The full stack of effects in a behaviour file.
Click on the post-processing behaviour file again. The inspector should look like this. Each bar is a drop-down of the effect options.
The screen shows white with black crease shading.
Click the checkbox on Ambient Occlusion. You’ll see the view go black and white. Very pretty, but not what we want. We need to change some camera settings to enable HDR imaging for the stack to work properly.

4. HDR settings

Clicking the HDR checkbox on the unity camera.
Click the HDR checkbox in the camera editor. This enables High Dynamic Range and lets you do wonders with any sort of post-processing effects.
A waring appears after checking HDR
With HDR enabled you’ll see we get a warning about Multi Sample Anti-Aliasing. This is a default feature that we will take care of with the new Post-Process Stack.
The quality settings for Unity
Going to ‘Edit’ > ‘Project Settings’ > ‘Quality’. Here we have all of our graphics settings. We’re only worried about the Anti-Aliasing setting for today. Click on it and select ‘Disabled’.
The quality settings for Unity
Once it is set to ‘Disabled’ we should finally be ready, and our scene should look normal. We’re going to ignore the Soft Particles warning today.

Those are all the obscure steps, from here you can just mess around and change things until they look good (that’s what I did the first time). If you come up with some awesome looking scenes or find some cool new features, let me know in the comments!

That said, you can also keep going and I’ll run you through some of my settings from my Petra project.

5. Tweaking values

An over look of Petra without any post-effects
With my current settings this is what the scene looks like. We already have AO turned on form our previous messing around.
The Ambient Occlusion Settings in my scene
My Ambient Occlusion settings:  My goal here is to create gradients around any corners to add a bit of depth and form. AO simulates the way real world corners get less light than the wall around them. Having a nice variance (especially in shadows!) creates a lot of depth in a scene, and masks straight CG-looking edges.
Fog settings
We can use the fog settings to add depth, or ‘Atmospheric Perspective’, to our scene. The idea is that as things get farther away, the faint particles like moisture and dust in the air taint the colors that we see. Here I went for a sandy look, but I later changed it to a blue. The blue contrasts with the reddishness of the sandstone making the scene a bit more interesting.

You can also access the world fog settings in the lighting window (Windows > Lighting > Fog)

The Depth of field Settings.
Here we have depth of field. Focus distance should be to the object you want in focus. Your aperture/F-stop gives you control over how ‘wide’ or ‘deep’ your focus is. You can check the preview setting at the top of the stack to find a ‘depth of field’ preview. This shows a black and white image of what is and isn’t in focus.
Depth of Field Preview image
Here is our depth of field. Black is in focus, white is not.
The image with Depth of field enabled and set.
The image with Depth of field enabled and set.
The bloom settings create a very over-exposed look
When we enable bloom it might be a bit much!
The bloom settings.
We can tweak the settings to get something a bit better. Intensity is how much the bloom affects the scene. Threshold is how bright something needs to be in order to create bloom. Radius is how wide a single bloom point would be. Anti-flicker will reduce flickering, very helpful if you are moving around.

Side note: Soft knee is a term I have heard in audio for a compression method that fades in with volume. I couldn’t find any info on what it does here. If you know please post in the comments and I’ll get it in here (with credit)!

The final bloom looks much better
Our new scene, with appropriate bloom!
The chromatic aberration settings
Our chromatic aberration setting:. CA occurs around the edges of a photo from the light bending in the lens, the more dramatic the lens distortion will have more CA. Very simple to use, but be VERY careful. Too much CA can ruin a scene (or make it in some cases), for a realistic amount make sure you can barely see it at all. (I normally go for half of what I think is a good amount.)
WAY to much chromatic aberration!
WAY to much chromatic aberration!
Hopefully just enough Chromatic Aberration.
Hopefully just enough Chromatic Aberration.
The grain settings.
We’ll use our Grain option to add some tactile feel to the photo, like the CA we don’t want this to be noticeable, but it should still be there.
The vignette settings
The last touch is our Vignette, this effect can focus and frame a composition very nicely. It can also darken a scene quite a bit. Off all the options I find that this one is the most subjective to the individual artist.
Messing around with vignette settings.
Intensity controls how far into the window the black sides come.
messing around with vignette settings.
Smoothness will blur the edges of your vignette.
Messing around with vignette settings.
Roundness lets you curve the edges of the vignette.
Grain is enabled, you probably don't need dithering!
The real last setting, we will leave disabled.

You did it!

There we are! Our final shot. You can now add this Post-Processing behaviour to any camera you have, or make even more!

Before and after the post processing stack.
Before and after the post-processing stack.

Now that we’re through that, go and create your own gorgeous scenes in Unity! These effects have so much potential, I can’t wait to see where they take the next generation of Unity graphics.

Let me know if you enjoyed (or didn’t)  learning about the new Post-Processing Stack. And definitely post a comment with any work you create using the stack!

2 Comments Add yours

  1. Bablofil says:

    Thanks, great article.

    1. MattMurch says:

      Thanks! I’m glad it was helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *