 Hello there beautiful people So in what is going to be this final step of the bonus steps We're going to put together a water shader and we're going to create a little lake so you can see the outcome on screen in front of you and The way that I've built this so this is the shader and this Is the material that I put together to be able to get that? So what we'll be doing in this video is rebuilding this talking about what the different things do and then we'll build this Little lake and we'll just show you how the lake looks when you have a kind of run around it So you can see that the the water looks kind of like it's got all the ripples on it's a nice calm lake It's doing its thing But I've also got a post-processing volume sitting just underneath it as well so that when we jump in the water It kind of makes it go all blue and a bit dark and a bit blurry So if we kind of jump in and out try again, so if we jump in and out You'll be able to see that kind of turning on and off as well So we're going to set about creating that in this video. It's going to be a fairly long one There's a lot to get through so I'm not going to explain absolutely everything I just want to kind of rattle through it as it is a bonus step So stick with it and if you do have any questions drop them below and I'll answer them if I can Okay, so the first thing I want to do is just create somewhere for this lake to be So I've already got one Just here as you can see So I'm going to put another lake just over here somewhere so you can choose wherever you want to put yours So in order to do that, I need to be back in my landscape editing mode. I'm going to use my sculpt tool Yep, I've got a nice big brush. Let's just Find where I want it to be And I'm going to hold shift on my keyboard just to make sure that I'm pulling that down like that. So There we go. This is really going to anger my light maps Okay, and I just want to have a look at how deep that is Make sure I've not overdone it. That's pretty good. Nice and dark in there Yeah, that'll do it So I'm not too concerned with the shape because this is just to demonstrate and if I was doing this In a real project, I take a lot of the grass out as well and probably change it for like underwatery weeds and stuff like that But for what I want now, I've just created myself a little area for the lake And I can now get on to filling that with some water so the next thing we need is the The mesh that we're going to apply the water shader to and there is one included Let's just go back into place mode and if I search here for plane This shape plane is Literally just a polygon square. So I'm going to drop this into the scene Into the level rather and you can see it's pretty small and it needs to be bigger. So let me just Scale this bad boy up wrong way Yeah, that's it. So I want this to Fill the area where my water is going to be and then I'm just going to move it into place So you should be able to see how I'm doing this Okay, and then I Just want to get the height of it right as well So I think something like that. So that's my mesh that's in place There were no collisions on it because I want to be able to go under the water So if I just hit play again and run into this, I should be able to just get under it I know I can't I need to turn collisions off. So let's do that Okay, so the way that we're going to turn collisions off on this is just click on the mesh itself We're going to scroll down in the details panel and we're looking for this collision area And the collision presets at the moment is set to default and I'm going to set that to no collision And then I'll just give that a little test to make sure that I can run beneath it Wonderful, okay So that is now ready for our shader, which we'll start building now Okay, so the first thing I'll do is go into my materials folder. I'm going to right click create a new material I'm going to call this M underscore lake water Seems as good a name as any and we'll get that bad boy open There it is just swap these around and This is what we have to begin with and we're going to need to make some changes to it because as you can see One of the things that we'll need for water is refraction, which is not available to us So let's make sure that all the things that we need for water are turned on straight away So the first changes will make is we've got this material domain at surface We want to keep that as it is but the blend mode is set to opaque Which means it can't be translucent and water is of course translucent So we're going to change that to the translucent option And you'll see at that point Refraction becomes available But there are some others that we'll need such as the metallic specular That are still unavailable. So we also need to make those available. So to do that We're going to scroll down a little bit further to this translucency section I'm going to turn on this screen space reflections and this lighting mode Which is currently set to this. I'm going to change to Surface translucency volume and you'll see most of these are now available to us so that we can plug in all the inputs that we need Okay, so I want to set this material up so that I can edit it within the actual editor So it a lot of these will be parameters that I can use in an instance So I'm going to start with the opacity And I'm just going to put a scalar into this Like so scale a parameter and we're going to set this up. So I'm going to call it opacity and We're going to have a default value of 0.5 The minimum will be zero and the maximum will be one Okay, so it's either going to be fully opaque or fully transparent And I'm going to start it somewhere in between and then I'll tweak it to my needs once it's actually on the mesh So that's the opacity taken care of The next thing I want to do because it's a nice easy one is the same for roughness. So I'm going to put another scalar into here Lovely and I'm going to set this up in the same way. So I'm going to call it roughness and I'm going to start the default at 0.2 Not very rough at all and Minimum is going to be zero and the max is going to be one happy with that. So that's Two parameters set up so far so good. Well done Shane and now I'm going to repeat this for the specular and the metallic as well Now normally I wouldn't use metallic on any material that wasn't actually metallic But it can give a really nice sort of reflection To the water that really helps. So let's get a scale it into the spec and I might choose not to use this But I still want it there. Let's put a capital letter on now. It's going to drive me crazy There we go And then we'll start that zero and one of a max of I'm going to leave actually because I might want to go higher So we'll go for that one and I'm you could also change the specular for a vector parameter as well Which gives you colors that you could mess with Okay, so let's go into metallic and Generally your metallic would just be zero or one. It's either metallic or it's not but I quite like An in-between value on the water No, not scaler metallic There we go. It's going to start at a value of zero point five I'll change it if I want to and the max is going to be one Okay, so that's pretty much all the Easy input sorted now move on to the stuff that's a little bit more complex So most of the rippling effect that you get on the water is is handled by Your normal map so that's going to be making it look that even though It's a flat plane that we're putting it on like it's got these ripples going up and they're going to go into the normal channel and I'm going to blend together Two of the same normal map that are going in different directions to make it look a little bit like water So to do that I need two texture sample nodes, so I'm just going to hold T and left click to get those Okay, I'm just going to put the normal stuff over here for now Okay, and I want both of these texture samples to have the same normal map applied So I'm going to select this and I'm going to choose Water and I'm going to use the one that's included in the engine you can find your own online So I also experimented with another one here like water So you can find any water normal map to get different results or you can make your own I'm just going to use the one that's built in the engine, which is T underscore water underscore n So I'll select it there, and I'll also select it here Now what I will need to do is get these to blend together and I'm going to do that with a Lerp node Which is a linear interpolate node so linear Interpolate there it is you see that shows up as a Lerp and What I'm going to do is put One of these into a One of these into B and the result is going to go into the normal of my main material node Because they've loaded in so you can see what they're doing what I need to do is get them moving and I'm going to use a panna node So like in the video where we made the The window flicker we use the panna node there. It's the same node But we're going to use it for a slightly different purpose. So we need a panna going into each So a panna in here And that's going to go into the UV's and another panna just here And that's going to go into the UV's there I'm going to use that to get these textures moving Okay, so I need to set some some parameters up on this So I'm going to go for a very small value here So 0.008 is one that I know I like for this and I'm going to go 0.016 On the the speed y direction and that will just make that texture move quite slow And on this one I want it to move in the other direction. So that's going to be Minus at the beginning and I'm going to do 0.03 And on this one I'm going to do zero sorry minus 0.07 Okay, and I'm going to give this a chance to catch up so you can see the preview here and show you that they're moving Okay, so that's caught up you can see it more on this one which is moving faster But you can see that that's now moving across this one's moving slower, but in the other direction So that's now going to be blended together. It will give us a ripply look What we also want to do though is Control how these are tiling to make sure they look the way we want them to look So we're going to put a few more nodes on this side to get all that happening So the first thing we'll need is a couple of texture coordinate nodes. So texture coordinate nodes Okay, and we'll put a copy of that one in and what these control is how many times your Your textures are tiled So this one here, I'm going to leave at one and For now, I'm going to change this in a second, but for now I'm going to put it into coordinate And this one I want to be slightly bigger So I'm going to change these to zero point five and zero point five And that means that it'll tile half as much as the other one So I'll pop that into the corner as well and then when these finish loading up You'll see the differences in size which will add to the random look of the water. We're trying to create So they've loaded in now and you can see that it's the same Normal map we're using but the size looks very different. So that's going to give us a nice different Look Okay, so there's one more thing that I want to Put into this before we call it done and that is making sure that we can control the tiling of the water So it'll be end up looking like the size of the ripples really and I want to control that from the material instance as well So we're going to need another parameter which we'll call tiling and we're going to need to use that to control these So I'm just going to pop that here. It's going to be another scalar and I'm going to call it tiling Okay, so the default value is going to be one on this and There's going to be no minimax because I might want to just go crazy with these and then what I'll do is get this To work is I need two multipliers One there and one there and I just need to make a little bit more space for this What we'll do is this tiling parameter is going to go into B of both of these the original Value is going to go into a and Then the output is going to go into coordinate and what that means is that using this parameter here We can now control the values that are in here because we're going to use that multiply So that's pretty much done. So what I'll do just so that I don't get lost is I'll select all that and I'll comment it And we're just going to call this Yeah normal and I'll also put in there plus Tiling just so I don't forget So that's that bit done. That's beautiful What we'll do next is we're going to put a value into this refraction So what I would like it to do so at the moment we're looking at this value here And we can see straight through it now with water it refracts when you look through it And it kind of makes what you see through the water sort of wobble around and we want to get the same effect So we're going to put something into refraction so that will happen on our shader and for that We're just going to use another scalar using a lot of scalars today Okay, we're going to pop that into refraction like so and we are going to call it refraction and Straight away without having to do anything else You can see that when we look through this shader now it is refracting the background behind it So that's beautiful So I'm going to leave all these values alone for now and I can change them on the material instance later But that's the refraction set up. So I'll just pop that over there and so now the last thing that we really need to worry about is the color and again, we're going to use a parameter for this Multiple parameters, but one thing that's really important here is that we use what's called a Fresnel node And what Fresnel is is it's that it simulates the phenomenon where if you're standing in water You look down at your feet you can pretty much see through the water But if you look out towards the horizon, let's say standing in the sea the water stops being See through and you can't or you can see is what's been reflected on the surface and your your Fresnel Will allow that to happen as well So we'll set that up and that's all going to go into base color. So the first thing we need is a vector param That says vector not spell it right. Oh, Shaney. Okay, there's your vector param By default, I want this to be white Otherwise, it's going to make it look all crazy. Now. I think I've done it wrong. So click on okay there And what I want to do is push this through another lurp node so like sale Where is look there it is Okay, now at this point. I'm copying the way that I saw someone else do it So I'm putting this into be the reason point into base because that's what the other person did I can't tell you anything other than that Okay, and then what I'm going to do is just put the result into base color and Then the Fresnel is going to feed the alpha and it's the alpha that that lurks between the color So let's set up that alpha. So the first thing that's going to go in is this Fresnel node, which is spelled Fresnel There it is. It's a utility. That's good to know and the result of the Fresnel is going to go into the alpha and Then we're going to put some parameters into the inputs So these are going to be just two scalars again. So Scala and we'll just copy that and put another one into these Okay, so we're just going to call this first one exponent in Exponent in and The other one is going to be called base reflect Okay, and then we can change those in the material instance at will to get the result that we're looking for Okay, so now what I'll do is just quickly change Or just tweak a couple of these parameters just to get them to something. I'm happier with So I want the metallic to be set to one which it is I also want the roughness. I'm just going to bring that down slightly to zero point one and The opacity I actually want to take all the way up to one and Then we'll wait for this to come out and that should give us a pretty nice watery look Okay, so that's now finished doing that and you can see that actually looks pretty nice So the the stuff that's been reflected behind it looks kind of watery. I like it so let's save this and Then we'll put it on to The mesh in a sec after we've created our material instance Okay, so we're going to go back into the main level editor here. We are and there's the hello There's the lake water that I've created So I'm going to right-click on that and create a material instance. I'm just going to leave the name at the default Here it is. I'm going to open that up. In fact, no before I do anything with it I'm going to add it to there. So I've got that selected and I'm going to go to There you go. So it's got the basic wall material in it for now. I'm going to swap that with the Watched it we've created and you can see straight away. There are problems with it. It doesn't look quite right Let's just frame that up so that we can Get a good look at it So yeah, there are definitely things about it that I don't like but Some things that I do you can see actually when it catches the light it looks pretty nice So we need to do some tweaking. Let's open up the instance Here it is. I'm just going to tear that away so that I can see what I'm doing as well Right so the the main thing that I need to change is Is the tiling So the ripples are far too big so I'm just going to knock that up to 10 to get me started. Oh I might leave it and that's pretty nice. Maybe 12 It looks good, doesn't it? Right, so we've got that one set up now. I need to have a play with a few other things So we've got our color and we can mess around with this So let's have a look. Do I want to add a bit of blue to it? I might do a bit of bluey green Yeah, that's pretty nice. Let's go back a bit more into the green spectrum Bit bit pond water then isn't it? I don't want to have it be too strong So got a bit of color in there. I Also need to play with this base reflection and this exponent in to get the Fresnel effect And you'll see that happening more in the preview here than on the water, but you'll get the idea So let's turn them both on and Then we'll change the values So on the base reflect I actually like to go about minus 0.5 to get me started on this and The exponent in I'm going to go to about 1.2 and Then you can see that you get this kind of haloed effect, which is what I'm going for I'm going to have a little play with the metallic And you see that's having an effect on this as well, so I'm going to bring this down a touch Maybe it's just something like 0.2 ish Pretty good The opacity I'm going to have a little play with that So I want it to be fairly strong again. You can see here. It's giving that really good Fresnel effect So it's more see-through in the middle now where we're looking straight on but when it kind of Goes at an angle it gets less see-through, which is good. That's what you want So I'm gonna go for something like zero point eight five pretty good The refraction is how much this wobbles the things below the surface of the water So if we have a look down, you can see that beneath the water things are all wibbly, which is good And we can change how much that happens. So if we up the refraction You can see that that that refracts pretty cool So I don't want to overdo this Something like that should be nice Okay, and I can now see I'm sure you saw this earlier in the video But instead of calling this one spec I called it scalar what a mug So I'll change that in a sec. But for now, let's see if I want to change this at all Yeah, I'll try it about a zero point that makes it a little bit brighter when the light hits it doesn't it? Nice, so I don't really want it to show up as black when that happens So that It's pretty nice and you can see that it's changing its values depending on what angle we're looking at it Okay, so let's go back into the main material make some changes. I want to save this. Oh I'm gonna go to my lake water I'll just Move that out of my way for a minute Right, that's called scale of that will not do specular Okay, I also want to comment this as Fresnel Fresnel not Fresnel, but it's Fresnel into it. Okay, and This one I'm just gonna name color because I didn't name that Okay, I'm gonna save that And we'll call that material done. So what you could do now is spend Hours playing with all the different properties of it to get it looking the way that you want But I'm fairly happy with it on my lake as it is and I just want to make some changes to what happens when you get in The water next Okay, that took a little bit of saving but it's finished now. So let's go back out into our level and See if we like it. So I'm pretty happy with it. Let me just hit the play button So we get closer to it and I need to have a look at what the fresnel is doing Might take that back down to zero. It's kind of bit strange What the refraction's doing not Fresnel refraction? Set that back to zero 0.1 Okay, I'm just gonna pass to you a little bit as well, right So that will do for now One of the thing that's looking a bit strange is when we look up like that the reflections are pretty good But when we look down we lose them. That's because we're doing screen space reflections And I want to pair this with a reflection capture as well. So I just close this for now and We're gonna look in here for reflection Capture and we'll do a box reflection. I think you can see as soon as I place that over The water looks a lot nicer because it's now using pre-computed reflections And when I look up and down I get a much more even result There is a a point where it swaps between the reflection capture and screen space reflections Which is a little bit noticeable but It doesn't look as bad as it did before so now if we have a little run towards this water You can see that that's not bad at all and when we look down we can see through it When we look further out we can't so everything's looking pretty good so far But we've got two problems with the under the water first of all the shades one-sided which means that when we look up nothing happens and Everything underneath the water just looks the same So what we'll do first of all is get this water to be not one-sided So in order to do that, I'm just going to be quite lazy. Okay, so I need to select the plane Which I can't do by clicking on it apparently so I'll do that and I'm going to copy and paste it or duplicate it So there you go I just copy and paste a control C and control V to get plane 4 And what I'm going to do is the scale on the Z axis which in Unreal Engine is the up and down axis I'm going to set to minus And what that should do is Invert it So if I just now look up You can see it's having the effect. It's not quite working as I had hoped but it is working So let's just move it down a touch And we'll try that again Yeah, that looks okay. I Might need to just adjust the parameters in the instance a little bit more to get it to look good from underneath as well I'll create a separate shader for it, but that looks okay. So the next thing I want to do is Get another post-processing volume in this level and that's going to create the sort of underwater look that I want So we'll get a post-processed volume There it is and we're going to drop it just on top of the water for now and We're going to get a better view of this There we go, and we're just going to put it roughly in the middle and We're going to scale it up So let's scale it in this direction first And then we'll scale it in this direction too. So it's covering it in both directions And I'm going to add just a little bit of height to it to make sure that I will always be contained when I'm within it and Then I want to drop it To about there and then I'm going to try and put my camera Just that kind of where the water Is just above me about there To make sure that I can see what I want to see something like that right So now with that post-processed volume selected We've got everything here that we want But what I need to make sure happens is that whenever we're in this post-processed volume It shows us the post-processing from it and not the unbound one that's doing the rest of the level And in order to do that If I can find it, I think I've got things expanded that I didn't need expanded. Where is it? There it is. It's this priority section So whichever post-processed volume has the highest priority when they're overlapping will be the one it shows So my other one set to zero So I'm just gonna set this one to one and now this will be the one that is most important when I'm in both and I'm also Going to drop the blend radius to five And then it won't it won't blend it'll just kind of happen instantly when we when we enter or instantly enough Okay, so now what I want to do is pretty much just set a color on this That's the main thing I want to do. Okay, so to get this sort of bluey color that makes us feel out we're in water With the post-processed volume selected, I'm going to go to global. There's this seen color tint that I can do I'm gonna first of all turn it on and then click on the color picker here and you can see that as I Move around with this. It's starting to tint the scene. So I want it to be quite a deep blue Like that and maybe quite dark as well So something like that straight away What I also want to do is add Something which is like a an image effect. So I'm going to do this chromatic aberration And what that does is just kind of blurs things out a little bit like that. It should look kind of nice Okay, so now I need to do is get this to change at the right time so you can see The post-process at the moment is too high. So I want it to change about There so I need to move it So let's move it down Okay Move it down a little bit more Okay, we'll try that. Yeah, that's pretty close. So you can see that's changing now pretty much when I dip below the water so Let's see what that looks like as we run towards it There's my water it looks all pretty nice enough to swimming got reflections It's all wobbly and when I go below it it goes a bit blue and at this stage If you really wanted to make it look cool, you could add more effects to make things up wavy Some water sound effects all kind of crazy crap to make this feel like water You could also add some physics to slow your play down as well or add some swimming But overall I'm fairly happy with that So I think the only problem I've got is with what this water is doing when I look at it from underneath But I'm pretty sure That I can fix that by changing some of these options because when I built this water previously I didn't actually have this issue So I don't think it's a huge one So probably by changing things like the base reflectivity. Nope or This one. Nope. Ah the opacity might do it. So yeah, I think what I would probably be tempted to do Is when I was under the water to have a separate instance where the opacity set all the way up or Change the Refraction value that's a lot better. Oh Yes, it was refraction. Look at that. It's beautiful. So I've got a what I'm at 1.2 ish for the refraction Which at least from underneath looks much nicer So let's just try running into there again Yep, so the water looks pretty nice. We've got reflections. I run in and then I look up and everything looks kind of wobbly So we get any reflections from underneath that looks beautiful. Okay, so That brings us to the end of the bonus steps As I said earlier, if you've got any questions about this that we've made here this beautiful water then Drop them in the comments and I will do my best to answer them I've also promised that I will be leaving this project alone And less for some reason inspiration strikes. I'll be working on new things going forward But maybe you know if I decide that I need to do something in this one. I might come back to it I can't completely rule it out, but I'm fairly sure I'm done So there are other things coming soon If you've got any requests stick them in the comments If you really want to help me continue making tutorials like these then please consider checking out the patreon campaign You can pledge a little bit a lot. You can do it for one month. You can do it for ever You cannot do it all it's completely up to you But it does help me keep doing this and it is very much appreciated If you want to make sure that you're really really good at Unreal Engine 4 in game art in general Then check out the link in the description to pluralsight. They have hours and hours and hours of content You can learn so much as I've said before that's where I do most of my learning at the moment And I really enjoy it as a platform If you do sign up for the free trial using that They send me a little bit of money for that happening about three quid and if you decide you don't like it after the 10-day trial Just cancel it. No bother So the last thing for me to do in this video is to thank you very much for watching If you made it to this video it means you probably watched the previous 40 steps plus these three bonus steps Which is a hell of an achievement. That's like what over five hours worth of Unreal Engine stuff You're clearly very committed. So well done. Thanks for watching and I sincerely hope I will see you in my next video Bye Thanks for watching If you really want to take your learning further than I can cover in this series, then I highly recommend checking out pluralsight They have loads of really detailed video courses covering game art and game development using Unreal Engine 4 When I learned how to use Unreal a couple of years ago This is where I went and I log in regularly to take a new course and improve my skills I recommend checking out the introduction to Unreal Engine 4 course by Joshua Kinney This is really good and offers a good overview of what you can do in Unreal You can get a free 10-day trial by using my link in the video description And you get full access to all of their courses for that time at the end of your 10 days You can either subscribe for more or cancel totally up to you. It's got to be worth a free trial though, right? I'd like to say a massive thank you to my patrons Your support helps me to keep making videos like this one and I really appreciate each and every one of you It really blows my mind that people will support my channel and my work by pledging their money through patreon So again, thank you all so so much If you aren't already a patron and you'd like to offer your support then please go to patreon.com forward slash Shane Whittington