Unity URP Post Processing Guide (Setup & Scripting)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys it's Matt welcome to speed tutor and today I'm going to show you how to control and work with post-processing in urp whether you want to be able to swap post processing profiles to be able to disable post-processing altogether or to be able to affect specific parameters of the actual post processing like in the example to change the bloom and the intensity with one click of a button so do be sure to come and check out my patrons get access to over 190 different scripts assets and projects you cannot find anywhere else and do be sure to check out all the links in the description for all the best sales savings and everything you can find in Game Dev okay so I wanted to start out showing that a new RP how to get the post processing to work properly and sometimes the issues that you face when you're trying to add this to your camera so in uip it may already have its own volume but if it doesn't you can create an empty game object I've just renamed this to post process and I'm just going to add a component called volume and volume can be set to Global unless you're specific to an area have the weight to one priority and you can create a new profile by clicking new I've already got some sample profiles so this is my normal profile and if you do click one it will add it to your project panel and then you can start adding effects and you can add Effects by clicking add override post processing and choose the effects that you want and you can drop down any of the effects and make sure you tick which of the ones you want to be relevant to you now sometimes that might not be visible on your main camera you can actually select your main camera and make sure that post processing on the rendering is tick and one another thing to mention if you scroll down to environment and you go to volumes you may have a problem that the volume mask might be on a different layer to what your Pros process is so say you had a custom layer appear in post-process custom layer of post process here my camera is not finding it now if I went back to my main camera as long as we have the volume mask is the same layer as what we had to the Press process it will actually make it visible so we're going to create a new script in C sharp and just call this post process controls I'm going to add that script to my post process volume area and I'm going to open up in visual studio now first of all what we want to do is actually find the profile that we want to create so I'm going to have serialize field private and then set this as volume now as you can see volume can't be be selected because it doesn't work now if we go to the top we need to use a specific namespace using a unityengine DOT rendering and then we can select the volume that we need and we can just call this Outpost processing volume so we can keep this nice and straightforward we did want to be able to disable and enable our effect so I'm just going to create a quick Boolean to be able to disable any post-processing if we need to and then in my next section what I'm going to do is I'm going to reference volume profile so I'm going to have a main profile and the second profile what we're going to switch to so then what I'm going to have is two public methods which I'm going to just change these on button presses to make it easier in the example so the main button will be to change the main process process and then the second one to the secondary so to be able to do that we want to have the post processing volume dot profile is then equal to whichever profile that we want it to be equal to so we'll say post profile Main and and that will be able to set it to that profile if we press that button and this one we can set it to the secondary so we can test that out now we need to make sure that we add the volume that we're going to use so we can just add itself you could have found this in start but I'm just going to add the volume itself and then I will find the normal profile or the main one and then the secondary one which is whichever one this one that I've just chosen now I'm going to quickly add these to my button presses so now you can see my button is referencing that method which is the main process now as we're playing the game you can see that I've got the original profile which I can click and the secondary profile which changes it to each other so let's say I click secondary go to the Post process you can see that it's sample I can click back on the original and then it changes and we'll swap our entire profile around now I'll give you an example of disabling and I've just made a new method called disable Pros process I'm just going to set disable equal to the opposite of whatever disabled is at the times in our case we just want to say post-processing volume dot enabled equals false or maybe whatever equals disable in my case you can set equal to true or false you can also turn the entire game object off by using dot set active which would do the same thing but in this case we're just going to disable the volume and then I'll make sure that my disable is true on the Boolean and I will just connect it up to my button on my post process now I can just select my button to disable and you can see that the volume is now off and if I click my button again we can swap it around now the last thing that you might want to know is how to specifically adjust a very particular parameters or post-processing effects so I've just created a new header and we're going to reference whichever effect that we want so in my case my example is going to be Bloom it doesn't like Bloom at the moment I'm just going to give it a name of underscore Bloom just so that we don't have a really similar name now we need to go back to the top again and have another namespace called using unit engine dot rendering dot Universal because this is the universal render pipeline in this case and then now Bloom is actually found so I can create a brand new method called adjust Bloom underscore Bloom dot intensity dot value equals whatever we want our value to be it could be 10. now this won't work because we actually need to initialize this variable so at the top we can just have a start method and we need to actually find this effect to be able to use it so how do we do that we need to say post processing volume dot profile dot try get and then in Brackets we'll set out underscore Bloom and then put a semicolon and in this case it will find the post-processing profile and get the actual effect that we want then we'll be able to set whatever Bloom is now you might not know what type of parameters each of the post processing effects have whether it's bloom vignette chromatic aberration or whatever now if you hold control and click on intensity it will take you to the class for Bloom so you can see it as threshold intensity scatter clamp tint and these and these are all things that you can adjust and you can see that if it's a float parameter you can adjust that all these are floats this one's a color parameter this one's a true or false or a Boolean parameter and integer parameter a texture parameter so with that now connected to my button I can press my Bloom and you can see that now if I go to the bloom post processing it actually changed my intensity to 10 and it looks like a beautiful summons down so this is just a quick rundown of everything that you need and I'll put this script on my patreon to get hold of it so you can have an easy way to reference exactly what you need to do in UAP do check out all the links in the description for the best sales savings and everything you can find in gamedev do be sure to check out all my great assets on the unity asset store and on my website for massive savings big thank you to all my patrons and a massive thank you to Peter Steiner thank you to everybody who supports the channel and don't forget to like comment and subscribe cheers
Info
Channel: SpeedTutor
Views: 10,036
Rating: undefined out of 5
Keywords: speedtutor, speed tutor unity, speedtutor unity, unity tutorial, speed tutor unity tutorial, post processing URP, unity URP tutorial, unity3d URP, unity URP 2023 post processing, post processing unity, how to disable post processing URP, unity urp post processing guide, unity urp post processing, unity urp change post processing profile, change post processing profile, unity3d tutorial, how to edit post processing unity, unity tutorials, unity 2023
Id: SeXdXvtunNY
Channel Id: undefined
Length: 7min 41sec (461 seconds)
Published: Wed May 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.