Many of us want our games to look and feel really good, and while art direction is clearly the most important factor in how a game actually looks, there's a few tricks we can use to give our games that extra bit of shine. A lot of what we perceive as visual polish in the games we play is often achieved through post-processing effects. Post-processes are full screen filters and effects performed on a camera's image buffer before displaying the image on screen. Post-processing is commonly used to add cinematic qualities to our scenes as they regularly simulate qualities of film cameras such as depth of field or motion blur. A great example of post-processing for me is the tilt shift effect on the camera in SimCity. This effect gave the game this sense of playfulness and it came from an understanding of how the image would look if it were a physical miniature toy and we were capturing it through macro lens. Another one of my favourite examples is how the post-processing and high definition range workflow is used to simulate our eyes adjusting to drastic changes in light as the player moves between environments. It's something that we've seen frequently in large scale productions and it's an incredibly subtle touch that goes a long way to improving the visual fidelity of your game. Hi there, I'm Matt and welcome to Game Dev Guide. And today's video, if you haven't figured out already from the title, is about how we can use Unity's post-processing stack to improve the visual fidelity of our projects. To get started, you'll first need to grab the post-processing stack from either the package manager or alternatively if you start a new project and choose 3D with extras, the post-processing package will be included in your project. So our scene here is quite nice but it's generally a bit flat. We're going to add some grading, an auto exposure effect, motion blur and some depth of field to make it a bit more vibrant and more realistic. There's two key components to getting post-processing effects working in Unity. A post-process layer and a post-process volume. The post-process layer sits on the camera and registers the effects of post-processing volumes. Let's add a post-process layer to our camera here and let's also make sure that the rendering path for our camera is set to deferred as this will give us some extra options to play with. Post-processing volumes can be assigned to different layers. For instance, this could be useful if you want specific post-processes to occur on specific cameras. For now though, we're going to keep all of our post-process volumes on the same layer, so let's set this to post-processing. Now, before even creating a volume, we actually have access to a post-process. Anti-aliasing. Anti-aliasing smooths out the edges of objects. So if we take a look at the edge of our building here and swap between no anti-aliasing and faster approximate anti-aliasing, you can see the difference it makes. Now you can play around with the three versions of AA here to get the best results but I tend to be happy with the results from FXAA. With that, let's take a look at building our post-processes and improving the look of our image. Let's create a new game object and call it post-effects. Here, let's add a new post-process volume. To give you an idea of how these work, volumes are actually physical objects that you can place in your scene to cause the camera to render post-processes when inside or nearby. You can also blend different volumes together. Just place a volume over here and we'll create a new profile on it. Then we'll set the layer of the game object to post-processing so that our camera will register the effects. Let's add a color grading effect and then we'll desaturate the image. Finally, we'll add a box collider to define the size of the volume. Now when our camera enters the volume, the effect occurs on the camera. If we adjust the blend distance, we can get a smooth blend from our normal image to our desaturated image the closer we get to the volume. Placing volumes in your environment like this can be an extremely cool way to change how your level looks in certain areas. However, we can also just set our post-process volume onto the camera directly by enabling the is global toggle. So let's go ahead and do that. Now you can see our post-processing profile is active on our camera regardless of where it is in the scene. So let's get started adding some juice to our visuals here. The first thing I'm going to do is set the high definition range and the tone mapping mode to Aces. For those who don't know, tone mapping is a process of mapping color values from high dynamic range to low dynamic range. I'll post some links to information in the description below, but essentially by enabling high definition range in our color grading, we're telling Unity to map greater differences of luminance or light values to our standard image. This enables us to work with higher light intensity values in our scene and get cool looking results. Aces or the Academy Color encoding system is a tone mapping algorithm that is regularly used in the movie industry and I quote, is becoming the industry standard for managing color throughout the life cycle of a motion picture or television production. So it's definitely worth using if you're going for a cinematic look. Next, I'm going to enable the saturation and contrast here, setting the saturation to around 30 and lowering the contrast slightly to about minus 5. I want this scene to feel quite vibrant and playful, so it's important to me that the colors pop a little bit. And with that, the first effect is done. From there, let's look at creating our auto exposure effect. This is the effect that simulates our eyes adjusting to various levels of darkness. Keep in mind, this will work best when there's a greater difference of luminance values in your scene. I've found that the best way to achieve this is to crank up your directional light intensity higher than one and set the exposure on your skybox to a similar value. The skybox should then match the auto exposure as it averages out the luminance value from the main light. The minimum and maximum values here determine the average luminance to consider for the auto exposure effect. The filtering value determines the upper and lower percentages of the histogram to be used to find stable luminance. What histogram, I hear you ask, let's select our camera and add a post-process debug component. And then let's enable the light meter. And as we move our camera around, you can see how the histogram changes to show the different levels. With this, we can now start defining our auto exposure effect. If we point to the sky, we can see that our highest value is about 1. So let's set this as our maximum. If we look down to the ground, we can see much darker values along the left here. So let's drag our maximum down to about minus 7. Now our ground is super bright, but if we point up to the sky here, notice how the camera adapts and brings it down to the correct brightness. All we need to do is bring our exposure compensation down to about 0.7 to average it out a bit. Then it's just worth moving the filtering around until you get a range between the two that you're happy with. And already that's looking pretty good. You can really notice if we move from a place of deep shadow out into the open. Now finally, let's add our depth of field effect to create our macro look. There are plenty of resources online explaining how depth of field works, so I'm not going to go too much into it, but essentially it recreates the effect of your eye when focusing on something closer to you. So let's enable focus distance, aperture and focal length. The basic logic here is that the smaller the aperture, the more outer focus things will be and vice versa. So let's set our aperture to 1.8. And let's increase the focus length a bit and increase our focus distance to about 32. And there's your tilt shift effect. We can actually visualize how our depth of field works by enabling the depth of field debug overlay. If we change our focus distance, you can see that the red band moves to show what's currently in focus. Anything that's in red is more in focus than anything that's in gray. So if we crank up that focal length, we can get an extremely tight tilt shift effect. As you can see, there's plenty to play with here to get your intended results. Finally, let's add some motion blur to our camera. This is fairly simple, the higher the shutter angle, the longer the exposure, and therefore the stronger the motion blur. Now I quite like adding subtle motion blur, so it's not too noticeable. So let's bring this down to about 120. It just adds a little something to the camera to smooth it out a bit as it's moving. Hopefully you can see with just these four effects, we've got a much more interesting looking scene. We now have a nice tilt shift effect and a camera that reacts to different variations in luminance. As you can see here, by adding even more effects from the stack, you can combine a number of these different post-processing effects to get some really valuable results and add some extra fidelity to your scene. And that's all for this video. I wanted to give a brief overview of some of the tricks I've been using the post-processing stack for. I thought it could be fun to do something a little different and focus a bit more on visuals rather than systems for a change. If you enjoyed the video, be sure to hit the like button and let me know your thoughts below. If you're new to the channel and want to see more videos, then please consider subscribing. Additionally, if you want more tips, tricks and tutorials, then feel free to check out some of these other videos already on the channel. Otherwise, as always, thank you very much for watching, and I'll see you again next time.