What is Post Processing?
Post Processing is a method or a technique that helps us to enhance the quality of images, videos, films, video games, etc. Generally, post-processing applies full-screen filters and effects to a camera’s image.
Use of Post Processing
Post Processing technique useful in
- Photo Editing
- Video Rendering
- 3D Realistic Games
Post Processing in Unity?
- In Unity, Post Processing stack Plugin is useful for applying unique image effects that directly apply to the main camera in the scene. The Post Processing stack is a key tool for the artist in unity to enhance game visual performance.
- Most of AAA+ Games, 3D Games, VR Game, or App will use this type of Post Processing Effects.
List of Post Processing effects in Unity
- Ambient Occlusion
- Chromatic Aberration
- Color Grading
- Depth of Field
- Auto Exposure
- Motion Blur
- Screen Space Reflection
How to use Post Processing in Unity
- If you are using an older version of Unity then you can download the post-processing stack from the Asset Store.
- In the latest version of Unity, you can access it via Package manager in the editor, this is the tested and verified version of the package.
- You can download it from GitHub.
Post Processing Demo in Unity
Let’s understand every effect in detail.
Create a Unity Project
- Open Unity hub and download the latest version of Unity
- Create a new unity project.
- Here we select “3D with Extra” template that by default added Post Processing Feature
- Assign Project name and directory.
- This is the Unity IDE
Import 3D Asset (Environment)
- I mostly download 3D free assets from Asset Store from learning purposes Sometimes there are very useful assets available in on sale.
- Download 3d Assets from the asset store as below.
Click on the “Import” button.
Go to the scene “Map_v1” scene.
Camera and Scene Setup
- In-Game window, Output show a black scene because there is no camera in the current scene.
- In Hierarchy Window, add a new camera in the scene.
- Set camera properties as below
- Transform Position : x=-10,y=5,z=0
- Transform Rotation : x=0,y=125,z=0
Sometimes texture or lighting not perfect as it shows in the Asset image. It happens when we change the unity version.
So we need to bake the current scene again.
Unity performs the calculations for Baked Lights in the Unity Editor, and saves the results to disk as lighting data. This process is called baking.
- Go to the Lighting settings. [Window menu > Rendering > Lighting Settings]
- Go to the Debug settings component in the lighting settings window.
- Click on the “Generate Lighting” button.
How to Apply Post Processing Effects
- you can find post-processing components in Rendering Category as below
Post Processing Components
- Post Process Volume is a special type of volume that can be added to a scene. These volumes are manipulate post-processing parameters.
- Post Process Layer will apply on the scene camera for full-screen effects.
- Post-Process Debug
- Click on the camera and go to the Inspector window.
- Click on the “Add Component” button and add the Post-Process Layer component.
- In the Layer property, select “Post Processing” in that Drop down list.
- Select anti-aliasing mode from the list. (FXAA or SMAA)
- Anti Aliasing is a software technique for decreased “staircase effect” or “jaggies“.
- Types of Anti Aliasing
- FXAA, short for “fast approximate anti-aliasing,” was created by Nvidia, and it is probably the best anti-aliasing method for low-end PCs.
- Other Types – SMAA, TXAA, DLSS.
- In the Hierarchy window, click on the + button and add an empty game object in the scene
- Rename this game object to “PostProcessingVolume“.
- Click on PostProcessingVolume object and then add the Post-process volume component in the Inspector window as below.
- Is Global: if checked, post-processing applies on every layer (whole scene).
- Weight: set to 1.
- Priority: set priorities between more than one volume.
- Profile: a profile means which effects we use in this volume.
How to create a Post Process profile in Unity
- In the Inspector Window, click on the “New” button of the profile property.
- The new profile is created in the folder that has the same name as the current scene.
- Click on the Add Effect button and add post-processing effects in the current volume.
- Change layer of PostProcessingVolume Object as below.
Let’s check out every effect of Post Processing in unity.
Post Processing Effects
Ambient Occlusion is a shading and rendering technique used to calculate how exposed each point in a scene is to ambient lighting.
It will make the scene more realistic via adding depth in the shadow part as below example.
Set ambient occlusion properties as below.
- Click on the camera object in the Hierarchy window.
- In the Inspector window, Add the Post-Process Debug component to the camera object.
- Assign camera object to Post Process Layer field because we added Post Process Layer in Camera Object
Post-Process Debug will be useful to see how the Post Processing effects working in the scene.
- Set the Debug Overlay from None to Ambient Occlusion.
- Here, the black part shows the Ambient Occlusion Effect.
- The Auto Exposure effect adjusts the exposure of an image according to the range of brightness levels.
- More about Auto Exposure:https://docs.unity3d.com/Packagesemail@example.com/manual/Auto-Exposure.html
- In Post-Process Debug, set the value of the Debug Overlay to none.
The Bloom effect creates fringes of light extending from the borders of bright areas in an image, contributing to the illusion of an extremely bright light overwhelming the Camera.
- Add Bloom effect in the Post-Process Volume component.
- Here, we use Lens Dirt to apply a full-screen layer of smudges or dust to diffract the Bloom effect This effect very useful in modern First Person Shooter games like Call of Duty.
- Download free Dirt Texture from below Github link (use only for learning purpose)
- Import downloaded Texture to the unity project.
- Assign this texture file to the Texture property of the Bloom Effect of Post-Process Volume
More Info Bloom Effect:https://docs.unity3d.com/Packagesfirstname.lastname@example.org/manual/Bloom.html
Chromatic Aberration is a visual effect that creates when the camera lens fails to focus all color wavelengths to the same point and, the result is like a game with 3D glasses. It’s also known as “color fringing” or “purple fringing”.
The performance of the Chromatic Aberration effect depends on the Intensity value. If the Intensity value set high, the render will be slower as it will need more samples to render smooth chromatic aberrations.
Fast Mode is recommended where possible as it’s a lot faster, but not as smooth as the regular mode.
- Set properties of the Chromatic Aberration component as below.
- Disable Bloom effect.
What is LUT?
A Look-Up Table (LUT) is a mathematically precise way of taking specific RGB image values form a source image – and modifying them to new RGB values by changing the hue, saturation, and brightness values of that source image.
- Download Spectral Lut file from GitHub:
- Import Lut file & Assign it in chromatic Aberration Property.
Color grading is the process of altering or correcting the color of the final image.
|Post Exposure||Adjusts the overall exposure of the scene in EV units. This is applied after HDR effect and right before tone mapping so it won’t affect previous effects in the chain.|
|Temperature||Sets the white balance to a custom color temperature.|
|Tint||Sets the white balance to compensate for a green or magenta tint.|
|Hue Shift||Shift the hue of all colors.|
|Saturation||Pushes the intensity of all colors.|
|Contrast||Expands or shrinks the overall range of tonal values.|
|The Channel Mixer is used to modify the influence of each input color channel on the overall mix of the output channel.|
More about Color Grading: https://docs.unity3d.com/Packagesemail@example.com/manual/Color-Grading.html
Here, we change the properties of color grading as below example.
Depth of Field
Depth of Field is a post-processing effect that adjusts j focus point of the camera. In reality, the camera can only focus on an object at a specific distance.
So if you want to add some depth effect in scenes like bokeh effect in photos then Depth of Field effect is very useful.
Grain effect will generate small particles on camera lenses like noise or unprocessed image.
The Grain effect is based on a coherent gradient noise.
|Colored||Enable the checkbox to use colored grain.|
|Intensity||Set the value of the Grain strength. Higher values show more visible grain.|
|Size||Set the value of the Grain particle size.|
|Luminance Contribution||Set the value to control the noisiness response curve. This value is based on scene luminance. Lower values mean less noise in dark areas.|
- Add Grain Effect in Post Process Volume Component.
- set grain effect properties as below.
In photography, distortion is generally referred to as an optical aberration that deforms and bends physically straight lines and makes them appear curvy in images.
Lens Distortion effect is useful to create effects like FISH EYE, Sniper Scope Zoom Effect.
The Motion Blur effect blurs an image when GameObjects are moving faster than the camera’s exposure time.
Motion blur doesn’t support AR/VR.
|Shutter Angle||Set the angle of the rotary shutter. Larger values give longer exposure and a stronger blur effect.|
|Sample Count||Set the value for the number of sample points. This affects quality and performance.|
If the game character moves faster than the camera , it creates blur effects.
Example: Car Racing Game – Need for Speed
Screen Space Reflection
The Screen Space Reflection effect creates subtle reflections that simulate wet floor surfaces or puddles.
The Vignette effect darkens the edges of an image, so the center part of the image looks brighter.
Vignette effect is a very famous effect in Photography and Film editing.
|Color||Set the color of the Vignette.|
|Center||Set the Vignette center point (screen center is [0.5,0.5]).|
|Intensity||Set the amount of vignetting on screen.|
|Smoothness||Set the smoothness of the Vignette borders.|
|Roundness||Set the value to round the Vignette. Lower values will make a more squared vignette.|
|Rounded||Enable this checkbox to make the vignette perfectly round. When disable, the Vignette effect is dependent on the current aspect ratio.|
In this article, you learned about different effects of Post Processing in Unity and how to apply those effects in unity.