-
Notifications
You must be signed in to change notification settings - Fork 747
Home
The new unity post-processing stack is an über effect that combines a complete set of image effects into a single post-process pipeline. This has a few advantages :
- Effects are always configured in the correct order.
- It allows combination of many effects into a single pass.
- It features an asset-based configuration system for easy preset management.
This feature is currently in beta, thus the API and settings may change in the future. We'll do our best to make sure we don't break compatibility between versions but it may still happen. Make sure you read the Restrictions and Known issues sections.
This guide targets the latest build, not the current trunk.
Easy mode :
- Download the latest build and import it into your project.
Advanced mode :
- Clone this repository (we recommend the use of GitHub Desktop).
- Copy the
PostProcessing
folder into your projectAssets
folder.
Note that you can move PostProcessing
anywhere in your project.
For maximum awesomeness we recommend that you work in Linear + HDR. It will still work in Gamma + LDR, although it won't look as good. Using the Deferred rendering path is also recommended (and required for some effects like Screen Space Reflections).
First you need to add the Post Processing Behaviour
script to your camera. You can do that by selecting your camera and use one of the following ways :
- Drag the
PostProcessingBehaviour.cs
script from the project panel to the camera. - Use the menu
Component -> Effects -> Post Processing Behaviour
. - Use the
Add Component
button in the inspector.
You will now have a behaviour configured with an empty profile. The next step is to create a custom profile using one of the following ways :
- Right-click in your project panel and select
Create -> Post-Processing Profile
. - Use the menu
Assets -> Create -> Post-Processing Profile
.
This will create a new asset in your project.
Post-Processing Profiles are project assets and can be shared easily between scenes / cameras, as well as between different projects or on the Asset Store. Thanks to them, it makes creating presets easier (e.g. high quality preset for desktop, lower settings for mobile, etc).
Selecting a profile will show the inspector window for editing the profile settings.
To assign the profile to the behaviour you can drag it from the project panel to the component or use the object selector in the inspector.
Back to the profile, selecting the checkbox on each effect in the inspector allows you to enable / disable individual effects. You'll find more information about each effect in the Effects section.
Here's a list of all effects currently available in the stack. This guide won't go over all settings available as they all come with tooltips in the editor.
Antialiasing is used for diminishing jaggies - stairstep-like lines that should be smooth.
It comes with two antialiasing modes :
- FXAA (Fast Approximate Anti-Aliasing) : a very cheap but low quality method that should run fast on every platform, mobile included.
- TAA (Temporal Anti-Aliasing) : a higher quality, more expensive method for desktop & console platforms (no mobile support). Make sure you read the Known issues section as this mode has a few limitations that remain to be addressed.
Screen Space Ambient Occlusion approximates ambient occlusion in real-time. It relies on the depth and normals buffers to darken creases, holes and surfaces that are close to each other. In real life, such areas tend to block out or occlude ambient light, hence they appear darker.
Beware that this effect can be quite expensive, especially when viewed very close to the camera. For that reason it is recommended to always enable Downsampling
and favor a low radius setting.
When working with the Deferred rendering path, you have the possibility to render the ambient occlusion straight to the ambient G-Buffer so that it's taken into account by Unity during the lighting pass. Note that this setting requires the camera to have HDR enabled.
When working with the Forward rendering path you may experience some quality issues in regards to depth precision. You can overcome these issues by toggling High Precision
but only do it if you actually need it as it will lower performances.
This effect computes reflections in screen-space based on the surface roughness.
More documentation to come...
Please note that this effect is currently very heavy performance-wise and has a few quality issues. We're currently in the process of re-working it from scratch.
SSR requires the use of the Deferred rendering path.
This effect simulates the properties of a camera lens. In real life, a camera can only focus sharply on an object at a specific distance; objects nearer or farther from the camera will be somewhat out of focus. The blurring not only gives a visual cue about an object’s distance but also introduces Bokeh which is the term for pleasing visual artifacts that appear around bright areas of the image as they fall out of focus.
Kernel Size
dictates the convolution kernel size of the bokeh filter, which determines the maximum radius of bokeh. It also affects the performance (the larger the kernel is, the longer the GPU time is required).
This effect simulates the fact that for most camera systems ‘light’ gets accumulated over time (instead of just taking discrete snapshots). Fast camera or object motion will hence produce blurred images.
Generally speaking, you should only use the Shutter Speed Simulation
settings. Multiple Frame Blending
does frame accumulation like old-school motion blur effects did and is mainly used to get a high-speed effect in racing games, or a "drunk effect". Both features can be activated at the same time.
Pushing Sample Count
up will affect performances negatively.
Shutter Speed Simulation
isn't available on mobile platforms.
This effect dynamically adjusts the exposure of the image according to the range of brightness levels it contains. The adjustment takes place gradually over a period of time, so the player can be briefly dazzled by bright outdoor light when, say, emerging from a dark tunnel. Equally, when moving from a bright scene to a dark one, the "eye" takes some time to adjust.
Internally, this effect generates a histogram on every frame and filters it to find the average luminance value.
The Histogram Log Min/Max
values are used to set the available histogram range in log units. The larger the range is, the less precise it will be. The default values should work fine for most cases, but if you're working with a very dark scene you'll probably want to drop both values to focus on darker areas.
Use the Filter
range to exclude the darkest and brightest part of the image. To compute an average luminance you generally don't want very dark and very bright pixels to contribute too much to the result. Values are in percent.
Min/Max Luminance
values clamp the computed average luminance into a given range.
Tweak Exposure Compensation
(also known as Key Value
) to adjust the luminance offset.
You can also set the Adaptation Type
to Fixed
if you don't need the eye adaptation effect and it will behave like an auto-exposure setting.
This effect requires compute-shader support.
Use the Eye Adaptation Debug View for easier tweaking.
Blooming is the optical effect where light from a bright source (such as a glint) appears to leak into surrounding objects. It is a very distinctive effect that can make a big difference to a scene and may suggest a magical or dreamlike environment especially when used in conjunction with HDR rendering. On the other hand, given proper settings it’s also possible to enhance photorealism using this effect. Glow around very bright objects is a common phenomena observed in film and photography, where luminance values differ vastly.
With properly exposed HDR scenes, Threshold
should be set to ~1
so that only pixels with values above 1
leak into surrounding objects. You'll probably want to drop this value when working in LDR or the effect won't be visible.
Anti Flicker
reduces flashing noise by running an additional filter on the picture beforehand. This will affect performances and should be disabled when Temporal Anti-aliasing is enabled.
You can also add a Dirt Texture
to simulate a dirty lens effect and affect how light is diffracted. You'll find a set of sample lens dirt texture in /PostProcessing/Textures/Lens Dirt/
.
This effect does work in LDR but to get a good, smooth, and large radius blur you'll want to make sure you're working with an HDR camera. Using a linear color space is also strongly recommended to get good results with this effect.
This effect offers a fully real-time HDR color grading pipeline based on industry standards and well-known softwares from the movie industry. Internal processing is done in the ACES color-space for best results.
A few tonemapping modes are available :
-
None
doesn't do any tonemapping at all and should be used when working in LDR. -
Neutral
, the default one, only does range-remapping with minimal impact on color hue & saturation and is generally a great starting point for extensive color grading. -
Filmic (ACES)
uses an approximation of the reference ACES output device transform curve for a more filmic look. Because of that, it is more contrasted thanNeutral
and has an effect on actual color hue & saturation.
Most of the other settings are self-explanatory and artist-driven. Trackballs usually work better in Log with HDR data but for ease of use Linear controls are also available as they tend to react better in LDR.
Hint: you can right click a trackball to reset it.
Aside from standard R, G, B, and Luminance (Y) curves you also get access to a set of Versus curves (secondary color correction tools) :
-
Hue VS Hue
shifts the input hue (X axis) according to the output hue (Y axis). -
Hue VS Sat
adjusts saturation (Y axis) according to the input hue (X axis). -
Sat VS Sat
adjusts saturation (Y axis) according to the input saturation (X axis). -
Lum VS Sat
adjusts saturation (Y axis) according to the input luminance (X axis).
Here's a quick cheat-sheet for the curve editor :
-
[Del]
or[Backspace]
to remove the selected key. -
[Ctrl]
to break a tangent handle. -
[Shift]
to align tangent handles. -
[Double click]
to create a key the curve(s) at mouse position. -
[Alt] + [Double click]
to create a key on the curve(s) at a given time.
Lut stands for lookup texture. It is an optimized way of performing color grading in a post effect. The lookup will be performed by using the original image color as a vector that is used to address the lookup texture.
Using this effect allows you to make all your color tweaking in Photoshop, Gimp, Paint.NET or any other graphics editing program and apply the result in Unity very easily.
Here's a quick example of how you would do that :
- Take a screenshot of your game (in play mode) and import it into your graphics editing program.
- Apply all the color adjustments you want. Remember, each pixel color must not depend on other pixels (e.g. blur or sharpen will not work).
- Once you're happy with the result, open a copy of a neutral Lut in your graphics editing program.
- Perform the same adjustment steps you made on the screenshot to the Lut or copy them over if you work in a non destructive way with adjustment layer.
- Save the Lut and drop it into the
Lut
field in the profile.
Neutral Luts are available in
/PostProcessing/Textures/LUTs/
and come in two sizes depending on the precision you need and the target platform (prefer the smaller one on mobile devices).This effect is applied in LDR after tonemapping.
This filter simulates fast refraction-based chromatic distortions at the edges and corners of the screen. As cool as it looks, it shouldn’t be over-used.
If Spectral Texture
isn't set, one will be generated automatically for you. A set of sample spectral textures is available in /PostProcessing/Textures/Spectral LUTs/
. They are lookup textures used to customize the chromatic aberration colors.
Performances depend on the Intensity
value (the higher it is, the slower the render will be as it will need more samples to render smooth chromatic aberrations).
This effect adds a thin layer of grain to the render to simulate "filmic" noise.
You can use Luminance Contribution
to control the noisiness response curve based on scene luminance. You can Uncheck Colored
if you don't need colored noise as it will make the effect faster.
This effect introduces darkening at the edges and corners of the image. This is usually used to simulate a view through a camera lens but can also be used to create abstract effects.
If you need a standard lens-like vignette, use the Round
mode. Classic
and Masked
are aimed toward more artistic vignetting.
Note that the vignette is applied before any tonemapping happens.
At the top of the profile inspector there is a foldout for debug views, these allow for debugging specific effects and various passes like Depth
, Normals
, Motion Vectors
and so on.
To help artists control the overall look and exposure of a scene, profiles come with a set of industry-standard monitors. You can find them in the preview area of the inspector. Like with any other preview area in the inspector, you can show/hide it by clicking it and undock it by right-clicking its title.
Each monitor can be enabled in play mode for real-time update by clicking the button with the play icon in the titlebar. Note that this can greatly affect performance of your scene in the editor, so use with caution.
This feature is only available on compute-shader enabled platforms
A standard gamma histogram, similar to the one found in common graphics editing software. A histogram illustrates how pixels in an image are distributed by graphing the number of pixels at each color intensity level. It can help you determine whether an image is properly exposed or not.
This monitors displays the full range of luma information in the render. The horizontal axis of the graph corresponds to the render (from left to right) and the vertical axis is the luminance. You can think of it as an improved histogram, with one vertical histogram for each column of your image.
The Parade monitor is similar to the Waveform only it splits the image into red, green and blue separately.
It is useful in seeing the overall RGB balance in your image, for instance, if there is an obvious offset in one particular channel, and in making sure objects and elements in the shot that should be black, or white are true black or true white. Something that is true black, white (or grey for that matter) will have equal values across all channels.
This monitor measures the overall range of hue (marked at yellow, red, magenta, blue, cyan and green) and saturation within the image. Measurements are relative to the center of the scope.
More saturated colors in the frame stretch those parts of the graph farther toward the edge, while less saturated colors remain closer to the center of the Vectorscope which represents absolute zero saturation. By judging how many parts of the Vectorscope graph stick out at different angles, you can see how many hues there are in the image. Furthermore, by judging how well centered the middle of the Vectorscope graph is relative to the absolute center, you can get an idea of whether there's a color imbalance in the image. If the Vectorscope graph is off-centered, the direction in which it leans lets you know that there's a color cast (tint) in the render.
This feature requires Unity 5.4.1+ or Unity 5.5.0b6+ (it won't work with previous beta versions of 5.5.0).
The following features only work on compute shader-enabled platforms (Windows / DirectX 11) and will be automatically and silently disabled on unsupported platforms :
- The following features don't work properly with Single Pass Stereo Rendering yet :
- Temporal Anti-aliasing
- Motion Blur
- Screen Space Reflections
- Temporal Anti-aliasing has a few issues right now :
- Doesn't work when MSAA is enabled.
- Currently broken on macOS + Gamma in Unity 5.4.
- When working with the Forward rendering path and MSAA enabled, the following features don't work correctly (this is fixed in 5.6) :
- Ambient Occlusion
- Motion Blur
- Motion Vector Debug View
- Screen Space Reflection has some artifacts on AMD GPUs.
- If you have several inspectors opened, only the last active one will be able to draw & update monitors.
- Mobile support is currently untested.
The Unity Post-processing Stack is released under an MIT/X11 license; see the LICENSE file.
This means that you pretty much can customize and embed it in any software under any license without any other constraints than preserving the copyright and license information while adding your own copyright and license information.
You can keep the source to yourself or share your customized version under the same MIT license or a compatible license.
If you want to contribute patches back, please keep it under the unmodified MIT license so it can be integrated in future versions and shared under the same license.
We will happily take pull requests if they improve any of the effects we currently have available.
If you want to contribute to the repository please do the following:
- Fork and clone the repository.
- In your fork create a new branch based off trunk.
- Make the changes you wish.
- Make a pull request from your branch to the same one on the Unity repo.
- We will either accept or reject it.
- We will run some internal code beautification tools.
- We will close the branch and merge it to trunk.
If you just want to report a bug you can use the Issue system on Github.