Using Post-Processing to improve visuals in Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
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 fullscreen 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 Sim City 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 a macro lens another one of my favorite 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 if 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 unities 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 I've seen 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 processed 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 a two 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 fast approximate anti-aliasing you can see the difference it makes now you can play around with the three versions of a a 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 let's place a volume over here and we'll create a new profile on it then we'll set the lair of the game object to post-processing so that our camera will register 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 D saturated 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 lifecycle 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 now 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 found that the best way to achieve this is to crank up your directional lights intensity higher than 1 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 determined 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 a stable luminance one histogram I hear you ask let's select our camera and add a post processed 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 I'll 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 not point 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 out-of-focus things will be and vice versa so let's set our aperture to 1.8 then 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 grey so if we crank up that focal length we can get an extremely tight taupe 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 [Music]
Info
Channel: Game Dev Guide
Views: 148,558
Rating: undefined out of 5
Keywords: unity, learn, games, gamedev, how to, making games in unity, tutorial, unity tutorial, learning unity, unity3d tutorial, programming, making games, tilt-shift, post processing, depth of field, dof, motion blur, bloom, postfx, post process, tilt shift, anti aliasing, visuals, improve, better effects, visual effects, filters
Id: _PzYAbPpK8k
Channel Id: undefined
Length: 9min 22sec (562 seconds)
Published: Mon Aug 26 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.