Unreal Tutorial - Black and White Shader with Excluded Objects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome to is what's going to be quite a quick unreal tutorial video on how you can make your game black and white and add a really cool old timey feel to your game um so i'm gonna break this into basic and advanced uh if you only want to make a black and white game then it's actually really simple to set it so your entire game world is black in black and white um but i am also gonna break it down to being a bit more advanced and have kind of a schindler's list style black and white where you can set specific objects that do show color where the most of the world will stay in black and white so we'll start with the basic one you need to make sure you have a post-process volume in your world so i've just looked up the default unreal level and that's already got a global post process for you if you don't have one of these already then you just need to drag one in and set the bounds to be infinite so that it stretches all the way across your world um you need to go to the color grading section you want to tick saturation and then you want to set this value all the way down to zero and that that's it that's the basic version everything is now black and white um and you get this cool old time effect so now that's done um i'm going to go into the more advanced one now um so if that's all you needed thank you very much for watching uh but i'm gonna do something a little bit more advanced and i want to have this single chair stay in color while the rest of my world stays in black and white so i need to undo what i did in the global pose process volume so for this one i don't want the saturation to be zero and what i am going to do is i'm going to create a new material and it's going to be a post process material that we add to our volume that will run through the different objects in the world and add effects to them so process volume black and white um so just need to open up this new material uh and go down to the material domain and set this to be a post process volume uh we'll just save that for now um and then come back into your post process volume if you go into post process materials add an element to this array um you want to do an asset reference and we want to just pick our post process volume black and white and as you can see our entire screen has gone black at the minute um if you set this to zero your screen comes back and that's because we've not actually set anything up in the material yet so we'll start there um if you open this up your new material and you are actually going to be looking for a scene texture and we want this scene texture to be the post processing input zero um basically this will output this color that comes out is whatever so if i was just to drag that straight to the emissive color and save this and i was to go back to the scene you'd see everything is now back as normal and this just gets the color out of what your scene looks like before you've done any post processing to it um so if we just plug that directly into the output then we just get the same color as the output and now if we want to change this to be black and white um instead of just pulling the color straight in we're going to do a desaturate on it so desaturation and then if we put that into the emissive color instead and save if we go back to the scene now it's in black and white and so now we're back to the way we were before with the basic version but we've done this through a material now for the more advanced bit of setting it to only work on specific objects we need to set up a few things in unreal so what you need to do is you need to go to your project settings first um you're going to go to rendering and then you want to look for the custom desktop paths so it'll be in the post processing section custom depth stencil pass it should already be set to enabled i think that is the default but what you want to do is click on enabled with stencil and i'll explain this a bit better about what this actually does um this allows us to create masks and what a mask means is i can click on this object for instance and if i go down to the rendering you're gonna have to extend out your rendering so it shows the more advanced features so normally you'll only see your rendering will show only this if you click on this little show advanced arrow scroll down to render custom depth pass if you click on that you can now set this custom depth stencil value and this allows us to create or specify objects on different stencils so if i set this to 1 for instance i can now apply effects to all objects that are set to one um if i it was set to two i could apply objects that were you know logic to all objects with value two and so on and so forth i think it goes i'm not sure if there's a maximum i think it goes up like 255 or something you probably wouldn't want that many different types of masks anyway but it's a nice little thing to bear in mind um so now that we've got that what do we do with it well if we go back to our material what we want to do in here if we just move this down a little bit we want to get another scene texture out and this time we want to set the texture id to be our custom stencil and whenever the the texture that comes out has a custom stencil um we can apply some logic here so if we pull out the color and we apply a component mask to it we want to untick the green value we only want the the red value from this mask for coming out the color and there's a few different ways we can do this so you can you could do a simple if statement here um just to do some logic so you can say uh and then if we drag off the b and just make a constant um yeah we could have that as zero uh basically this if statement will plug that into the emissive color um what we're saying here is if if the object we have if the mask uh like if this custom sensor value is set to be greater than zero so in our case one then we would actually just want to take the scene uh input so we would drag that into there and so that would just be the scene color however if it is zero or even less than zero and then we would want it to go through the desaturation node and so you can see if you've not used if statements in materials before it's basically this is the color that will come through if a is greater than b this is if they're equal that is if a is less than and now if we go back to the scene you can see because i've set this stencil value to one this object is in color and the rest of the world stays in black and white if i set that to zero it goes back to black and white you know because we used greater than i could say it's a six and it would come back in color or whatever you want um but that's basically it uh i was quite surprised i didn't see any tutorials on this already that don't really go into depth on what you actually need to do so i just thought i'd make this quick one and i really hope it was useful for you and i definitely plan on using it for one of the kind of games i've got on on the back burner at the minute um so yeah i just wanted to share what i'd found out with you uh if you like this video give it a thumbs up and if you found it useful i subscribe to the channel because i post little things that i find like this quite often um i hope you the video was informative for you and thank you very much for watching see you next time
Info
Channel: The Game Dev Channel
Views: 16,174
Rating: undefined out of 5
Keywords: unreal black and white, unreal engine black and white with excluded objects, unreal engine schindlers list, schindlers list, unreal post processing, black and white, unreal post processing material, unreal engine stencil buffer, unreal engine, game development, ue4, unreal engine 4, video games, game development unreal engine 4
Id: nrN4LxY_J7k
Channel Id: undefined
Length: 8min 45sec (525 seconds)
Published: Tue Feb 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.