How to Use Post Processing in Unity
Adding Image Effects and Filters
The first step in using Post Processing in Unity, is to install it from the Unity Package Manager.
- In Unity, click on Window and select Package Manager.
- Inside the Package Manager, Be sure you have “Unity Registry” selected, in order to see all available packages.
- Scroll to find “Post Processing” and if it is not already installed, click on the “Install” button.
- After the Post Processing package is installed, you can find it in your Projects panel, inside the “Packages” folder.
Applying Post Processing Effects
- First, right click inside the Hierarchy panel, select “Create Empty”, and rename it “Post Process Volume”. This volume game object will control all of the effects of your game.
- In the Inspector panel, click the “Add Component” button, begin to type “Post Process Volume”, and select “Post-process Volume” from the list.
- Place a checkmark in the “Is Global” section.
- Click the “New” button in the Profile field. This will add a “Game_Profiles” folder inside your “Scenes” folder, containing a “Post Process Volume Profile”.
Setting up the Camera to Render the Effects
- Select the “Main Camera” in the Hierarchy panel.
- Click the “Add Component” button in the Inspector panel and add “Post-process Layer”.
Next, we have to define a layer to apply Post Processing effects.
- Select “Post Process Volume” in the Hierarchy panel.
- In the Inspector panel, select the “Layer” drop down menu, click on “Add Layer …”, and name it “Post Processing”.
- Again, select “Main Camera” on the Hierarchy panel.
- In the Inspector panel, inside the “Post Process Layer (Script)” section, click on the “Layer” drop down menu and select “Post Processing”.
- Select the “Post Process Volume” in the Hierarchy panel and set the layer to “Post Processing”.
Checking Out the Different Effects
- With “Post Process Volume” game object selected in the Hierarchy panel, click on the “Add effect…” button inside the Inspector panel to add some effects. Hover over “Unity” for a list of available effects.
- For an example, click on “Color Grading”. This is like using Photoshop.
- Click on the effect to open its available options.
- To get truer, brighter colors, select “High Definition Range” (HDR).
You will notice a warning:
ColorSpace in project settings is set to Gamma. HDR color grading won't look correct. Switch to Linear or use LDR color grading mode instead.
I want to use HDR, so I will have to change this in the Build Settings.
- Click on “File”, then click “Build Settings…”.
- On the Build Settings window, click the “Player Settings” button.
- In the “Player” section, change the “Color Space*” from “Gamma” to “Linear”.
Unity will recompile the project, which will allow you to use Tone Mapping. Once Unity has completed recompiling your project, you can close out the open settings windows.
- With the “Post Process Volume” game object selected in the Hierarchy panel, you can go to the Inspector panel and experiment with the settings in the “Color Grading” section. You can add other effects and experiment with them as well.