Unreal Engine 5: Water System in UE5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello there today we are going to talk about annuals water system it's a fairly complex and well-made system which provides us with all the water bodies like the ocean the lake rivers etc but it's still experimental and there are some limitation to it so it's not advised to use it for production so we'll talk about all the water bodies the fluid simulation like ripple form and the limitation it has and some of the workarounds that we have we'll use this small island as our example this is created in gaia and with a little know how you can create your own island so first thing first water is a plug-in and we need to enable it we'll go in the settings right here and then under plugins we will search for water now there is the water and the plug-in is also showing that it's experimental so we'll take this now if you haven't take it already then it will ask you to restart so simply restart it and you will get all the water functions now once you have enabled the plugin we'll go into the content browser and here under settings make sure you have the show engine content and show plugin content so what this will do is let me contract this so here it will show us the engine content and if we expand it it will show us the plugin content now under the plugin content if we scroll down there will be this folder water content now this has everything we need for the water system but we'll use the create button right here to spawn all our water bodies so if you click this and go to all classes and simply type water on your keyboard so w-a-t-e-r now here we have a bunch of stuff the water body custom the water body island lake ocean river brush manager and all that stuff so let's start from scratch we'll go to a new level and click the empty open world and create now first let's bring in the lighting and stuff so for that we'll go to window and click environment like mixer now we'll click create skylight atmosphere light sky atmosphere volumetric cloud and height work now here everything is created so we'll put all of them under one folder so let's call it light and post and select everything and put it under the folder now come the first limitation of the water system which is it needs a landscape to function so you can't have it without the landscape we'll learn how we can work around this later but you need landscape for the water to function most tools in unreal depend on landscape so we'll bring in the landscape so we'll go to select mode and click landscape now here is one of the frequently asked question that you don't have these layers so you can see all these layers the ground moss rock soil and all this stuff but you don't have it because you have not set the layers inside the material i'll talk about it towards the end and maybe put the material in the description so for now let's assume you have a material and you hold the layer set up now either you can import your height map from right here or just create a simple landscape so first to explain some things we'll start with the simple landscape then we'll build our island now another thing you need to enable for water to work is to enable the edit layer you need to take this right here i'll explain why we need this once our landscape is created and then we can choose our scale and stuff let's only increase the number of components so the map is a bit bigger and create the work now it's created so we'll go to paint and create a layer info for this one i already have so many layers info created so i'll use one of the existing ones once you have created this for the first material it will automatically apply the textures and if it is not applied then you see black right here then you will right click this and click fill layer then it will fill the landscape with that layer now let's come to why we needed to tick that enable edit layers so we'll go to the normal mode so we'll click here and go to select and once we have our landscape selected under details if you already have a landscape treated then you can enable the edit layers from right here so under details you will search for enable edit layers so here it is so we are making sure that this is sticked on and by the way if you don't have this detail tabs or any of these steps then you'll go to the window tab and you have everything you need from right here and you can even have multiple tabs you can dock it anywhere now we already have this detail tab also when you are creating landscape and if you want to change your scale later on remember when we were scaling our height map to our landscape in gaia so if you have already created your landscape but you forgot to scale then you can also scale it directly from right here now let's go to the enable edit layer we'll go to select and landscape if you take a look at right here the edit layer now here this is layer one so this is the bottom layer and you can right click and create another layer and maybe another layer so what this layers allow you to do is you can do specific stuff in each layer let's go to sculpt and maybe decrease the brush size and while we have the layer one selected if we sculpt it now this sculpting is done in the layer one which means if we hide the layer then our landscape is back to normal so if you are doing manual sculpting or painting then you want to have multiple layers so that if you mess things up in some later stage you can go back to that layer or maybe delete the layer or reset that layer and while resetting you will right click and clear so you can clear this sculpting and painting now we haven't painted anything otherwise there would also be an option to clear the paint or you can clear everything so it's useful and what what i will use it to do is water will change our height map it will affect the shape of our landscape so to make sure that we can go back to our original landscape it will create its own layer cold water and make all the changes in there so later if you want to undo this then you can simply delete that layer and it will go back to normal so let's delete these layers for now so we'll right click and delete yes delete yes and go back to select now we'll come to the outliner and the first thing that will bring in is the option now i want you to keep your eye right here and see what happens when we spawn the ocean so we'll go to the create button and under all classes we'll search for water and there is our water pollution now keep your eye there and once we click it you'll see that there are three things spawned the water body ocean which we wanted and two extra things like the water zone and the landscape water brush manager let's delete this height for it's very annoying okay we'll talk about what each of these does first i'll show you that extra layer water created so we go to landscape and there it is the water layer changes will be in this layer that we can delete later now the first is water body ocean so let's align it with our landscape so we'll select the landscape and send it to the location zero zero zero you can type zero zero here or click this button right here which will reset it now one limitation with water system is it only works with smaller landscape it starts to have problem with larger landscape and it also starts to have problem when we go further from the origin so we'll bring our landscape to the origin if you look at our landscape this corner is it origin we want our landscapes midpoint to the origin so the water is closest to the origin at all times so the landscape was one thousand nine meter by one thousand nine meter so here we'll do half of one thousand nine meter so one thousand nine one annual unit is equal to one centimeter so we'll put two extra zeros to convert it to centimeter divide it by two and add a minus sign i will copy this and paste the same here now the midpoint of the landscape is exactly at origin and maybe let's raise it about 200 meter from the origin so i'll put 200 meter into centimeter now we'll take our water pollution and again bring it back to origin by clicking this and look at that there is our water now we'll adjust the height of the water so we'll take this and take it up in this head maybe not that much so bring it down so something like this so now there we have our landscape and the water system is affecting our height map which means it's changing the shape of our landscape so if you take a look right here below the water you can see that the shape is changed right here and with the water system it actually spawned the water mesh and if you go below the water mesh there is a post process applied now we can change our water shader as well as the underwater process material under the under the water bottle if you go to details move down a bit right here under rendering you have the water material and you have the underwater brush process material now if you don't like the shader modify the existing metal material so if we click this button right here it will take us to where this asset is in the content browser now this is under engine plugin and water content and this is what we discussed earlier now here is a little tip for you if you are changing anything in a plugin or anything in the engine content now first you make a copy of this and change that copy you don't want to change this otherwise it will change across all the projects so whenever you start a new project in annual engine then that will be changed for all the projects so you don't want to do that otherwise if you mess things up then there is no going back now i have already copied this material right here so you can see this am material ocean we'll rename this and add underscore user at the end so it's easier to distinguish from the water content material and that we created this material and it's not created by andrea so i'll put this material right here now if you double click this and there are whole bunch of parameters you can change anything and don't have to worry about messing things up because if you mess anything then you simply delete this and make another copy of this now the same goes for the underwater post buses now let's get back to our ocean so this what about the ocean actor right here is the spline you see right here so if you click any of the spline points then you can move this and the shape of the ocean will change so the spline is what defines where the ocean is so if you change the shape of the spline then it will change the shape of the ocean itself now it's planned you can choose any of the existing points and move it around and one thing to note is that it won't move along the z axis so you are free to move it everywhere and it will not change the z direction now in this spline if you want to add another spline object so we'll go to anywhere on the spline so let's say i want to add a point right here on the spline so right click and click add point here so we have added another spline point now to add this we can also duplicate this we right click and click duplicate spline point and it created this duplicate point and we can move that point around and a shortcut for this is if you hold alt and drag this around it will create a new point hold alt drag new point and you can move the new point around and with any of these spline points selected if you right click then you get properties for this plan point now under select spline point you can choose to select all the spline points or the previous spline point next or you can add a spline point next to it or previous and the next is the spline point type which you can change from now you can choose between curve linear constant and why would you want to do that the answer is simple so you see right here this spline is weird like this and it will take a lot of time adjusting this so it's better you just right click spline point time and change to linear and you can easily adjust all these plan points roughly and finally when you are done you right click select all the spline points and again right click and change it to curve then you will have nice curves already made which you can take a little bit to get more precision now this is the basics of how you can manipulate this plant now similar to ocean we also have lake and us so let's bring in a lake right here search for lake and there is our lake swing it may be in the center and bring it down maybe a little bit and select the spline points and move them around and same as the ocean we can't move them in the z direction however just like ocean if you click anywhere and now like then this is the whole water body leak we can move this up and down so the height of all the spline points will be determined by this and we can change the height for the individual spline points we'll take care of all those overflowing issues later now most of the properties that we have under details are same for lake ocean and river so we'll take a look at one and it will be same for all of them so let's move to the selected points so remember all the properties that i talked about when we right click on this now we have all of these right here so this is the select all span points so we have selected everything and select this platform then we have the select next point select the previous point add next point and add a previous point and then we have to additional select the last spline point and select the first plan point and then we have the location rotation and the arrive and leave tangent which are these two handles so if you make change to this you can see it updating right here let's select this plan point and now under type we have linear curve all of them so if you want to adjust it roughly we'll select all of them send them to linear and later when everything is sorted out you can change them back to curve to get smooth edges and under what we can change the properties the velocity will talk about the velocity and river so we'll skip this the next one is what about index which is shown one and you can change this and this one is used within the material so you don't have to worry about it just know that it's a random number which is reference inside the material to know which one is the lake and which one is the ocean so since we spawn the ocean first the ocean has index of zero and the lake has index of one and when we later spawn the river it will have index of two and the next one under advance are the island and the exclusion volume so we'll talk about the islands when we are creating the actual island and the exclusion volume i think it worked earlier in until four there was a parameter in the water material called hole so if we had a water exclusion volume then we can turn on the hole from the material but now that parameter is gone if any of you knows what happened to it you can comment down below and to find that exclusion volume will go right here and under all classes we'll search for water sure enough there's the water body exclusion volume earlier you could just put it anywhere and it will create a hole after we turn the hole on in the water material but you don't need to worry about the island and exclusion both for the most parts when we spawn the island or the exclusion volume then it will automatically add it wherever needed so let me show you a quick example so maybe in the ocean we want to create an island so we'll go to all classes search for water there's and then there is water body island now after we have created this island we will go to the ocean and sure enough under island we have that island no need to worry about it next are the terrain settings now all these train settings determine how our landscape is being affected so first let's look at the ocean now here is the toggle for if you want to use the curve or not and here is the actual curve that we are using so notice the shape of the curve and then notice the shape the landscape is making if you make any change right here then you will see it being updated in real time and as i said earlier first we'll make a copy so there is the float curve this is a simple float curve we can create our own or just simply copy this let's copy it here call it user and let's put it right here and now if you open this now as we make changes to this say right here then you can see the changes being reflected in real time so this is how the curves affect our landscape and with the curve we can offset the edge so let's say the edge is right here we can maybe have minus 4000 and then the edge will move further and further and we can choose how deep it is and how wide it is okay so i had to restart because of a weird bug and let me tell you there are going to be a lot of bugs with the water system so the next is underway the wave attenuation water depth so this one tells us how flat the waves are close to the shore so you can see in the ocean there are ways and they are getting almost flat around the show this is because this is set to 2048 if we set it back to zero then you'll see these waves around the shore and it looks horrendous we don't want that so we'll move it to a higher value so 2048 and then they are getting flat real nicely next we'll come under the wave source this one defines all the settings for the waves so in unreal we use gerstner ways and we have a gershner asset already created in the water plugin if we move to it then there is regard for the ocean and then there is irrational wave for the lake both are fundamentally the same only the properties are changed so if we open this then we have a whole bunch of properties and you can actually see it in the viewport how the waves are being affected and by the way i already opened it so it's open like this otherwise you'll have something like this and then you'll go and open these one by one which is tedious so we have a shortcut for that so if you have a bunch of children down the hierarchy you can hold shift and then left click and it will open all of them if you do a simple left click then it will open one by one but if you do shift left click then it will open everything will not make any changes right here so let me make a copy of it real quick so actually let's not make a copy i'll show you how we can create our own asset so we'll go to an empty area and if you right click and go at the bottom under water there is this water wave so let's name it ocean wave user so that's how we can create it it's the same and the default properties are used in the ocean so let's go over these properties so the wave source we have the gaussian waterways we only have these in unreal so there is only one option right here and then the same goes for the wave generator now under default the first is number of waves so the higher the number of wave we have the more realistic it will look so if you were to decrease this maybe let's say two now these are the waves that are being created which may be good for a mobile game so they use very low performance and as the number of wave increases the complexity also increases and performance takes a hit and higher the number of ways the better it will look so if you go maybe 64 and you'll see these white things right here now it's more visible this is because of double-sided geometry again it's one of the limitations so i'll go back to 16 and she changes the random noise it is generated by so we change the seed then we'll have a different pattern of waves and then there is also the randomness how much render we want the nose to be now under wavelength we can change the maximum and minimum wavelength so it takes a bit of physics so the wavelength is the distance between two points on a curve so if you take a sine curve then the distance between two points increase the max wavelength now the waves are going a lot more distance before they are getting flat and then we also have a falloff with the wavelengths so you can play around with these values to get different different results next come the amplitude so amplitude is how high or low it can go from a point so if you increase the amplitude then the waves will go higher and higher and if you increase the minimum altitude then the waves will go lower and similar to wavelength we also have a falloff for the amplitude and the next two are the dominant wind angle and the direction angular speed so the dominant wind angle is in which direction will most of the wave move towards so basically like a wind so if it is set to zero then this is turned off and we can have it follow his general direction so if we set it to 45 let's set it to zero so you can see all of the waves are moving in the same direction we can change that direction and the waves are moving in different different direction and the direction angular spread complements this so when we set it to zero then all the waves were moving in the same direction and if you change it then there will be a variance so if you change it to be 10 or 20 so then you can see that most of the waves are still moving towards 180 but there is a variance and some of the waves are moving in a bit different direction from 180 so the direction is decided by the dominant wind angle plus minus the direction angular spread so reset this and the last one is the steepness so here the smaller waves are more steep the larger waves are less steep and similar to amplitude and wavelength we also have a falloff so these are all the settings about the gaussian airways now you can choose all of these settings in advance and use that asset here or you can change the wave source from right here and here we are seeing the asset reference which means it will reference a asset we can simply change it to westerner waves and we can have all those settings right here and change all of these now these settings will be changed for this instance alone which means that if we make any changes to this ocean and then later if we decide to spawn another ocean then that ocean will not have the same properties as these whereas when we are using a asset we can have same properties over to the next ocean now these are all the properties for the ocean and under lake we have all the same properties except these plant properties so we'll talk about these plant properties with river so our next water body is river so we search for river and river is again a spline so we need to adjust the height first so maybe something like this and the first thing you need to see is where the river is moving so the river is moving in this direction so which means the orientation is right so we can choose this spline point and attach it to the lake and have this final one and attach it to the ocean and unlike the ocean and the lake this time with the river we can move each spline point in the z direction as well so we'll move this down instead so that it blends nicely so something like this we can add another point right here and maybe move it down further and you will see some of the water spilling right here and now again to fix this we'll offset our edge a little bit so we'll search right here edge offset and there is the as offset so sometimes it's not fixed by the edge offset so we'll move the spline a little bit so that it's gone now it's mostly gone so you have to adjust some things from time to time so now you will see that all our water bodies are automatically blended so we only put a river right here but you can see that these two are blending nicely and again the ocean is again blending nicely maybe not that nice will fix this but they are blending real nice so with river if you go down to the materials so we have two additional materials in the transition the river to lake transition material and the revert ocean transition material which is what is applied right here so this is how the materials are blending and we'll talk about how the actual water is blending in a little bit after we fix this one right here so this one looks a bit odd because this part is moving a lot and this water is not moving at all so to fix this will slow down the river so another good thing about river is if we select individual points and go to the spline point properties we can change the velocity of each spline point differently so you'll see right here all of these are 128 by default so all of them are moving at the same speed if we change this velocity to let's say 0 then you'll see this water is not moving at all and see this water is moving and this water is moving so only the velocity of the water at that point is stopped so this gives us a better control so we'll not use it right here we'll use it to stop the water right here so first we'll make a spline point right here so now this one is moving at 128 and let's change this velocity to zero and now you'll see the water is going down from 128 to 0 at this point so with each spline point we get the depth let me show you what it actually does so we'll select this point and if you increase the depth then the url will be deeper at this point 2000 is a bit much but we'll see the effect and we can even change the rear weight for this point so if we change it to 4000 then river will divide only at this plant point now these are the three water bodies that we have and the another one we talked about is the island let me show you quickly what that does so we search for island then if you are in the ocean or the lake then we can create sort of a smaller island right here and similar to what we have done till now you can change the spline points and such and this island is automatically added in the ocean so we can have multiple islands like this and we'll take a look at those when we are creating the island so now let's talk about the another reason this water is blending nicely the first one was because of the material between the river and the ocean transition and the second one is all of these water is actually single mesh so if you go right here and turn on the wireframe mode then you can see all of this water right here so this is a single mesh so this is the same mesh which is used in the river the lake and the ocean so all of this being a single mesh and some of the material magic and we have a well blended water and another interesting thing about the water is this actually looks like it's transparent we can see the ground below it but the water actually is opaque so it's giving us an illusion that it is translucent but what actually happening is it's rendering the water in a separate path once the landscape is rendered then the water is rendered in a separate pass and then those two are blended right here so this one right here actually is blending half of the landscape and half of the water material so that's why it looks translucent while it's actually opaque so the landscape is visible at all times and rendered even though it's below the water and to show it even better first let's bring in a cube right here if we apply an actual translucent material to this cube then we'll see the actual effect happening let me go back to the content browser so we'll create a material real quick and under blend mode this is so big we'll change it to translucent let's give it maybe red color and opacity of 0.5 maybe now this is an actual translucent material now if you apply it to the cube so this is a translucent cube if you move it inside the water then if it was a normal water material then it should be visible but if you drop it down you'll see that the cube actually disappears so you can see that this is not actually translucent so there is also the limitation of using the translucent materials with this but having it opaque gives us better shading and saves us some performance and speaking of performance if we go back to the water mesh so you'll see this blue one is the water mesh and if we move back then the quartz are automatically adjusted so it's just like nanite it can automatically adjust the lods so when we move further and further away then there are less and less walls this also saves us some performance and also the fact that it's not actually a high-res mesh and these are all the instant squats everywhere now let's talk about the other two things which were spawned when we spawned the ocean earlier which is the water zone and the water brush manager so this water surface right here is not the water body ocean it's actually the water zone so the water zone is spawning all of this water the ocean lake and the river all of these are spawned and that actual mess is this water zone so if you hide this then water is hidden so what this portion does is if you hide this spline is making all those height map changes so it's essentially telling that this is where the water should be this is telling the water brush manager so the water brush manager handles all the details so these water bodies actually define the area where the water should be then they tell the water brush manager and the water bus manager collects all the information and then finally tells this is where you have to spawn the water and what is on sponsor water and one another thing is so when you look at the ocean it looks like an endless ocean but it's not actually endless ocean and if we move further away it should be visible somewhere around here it's blended really well so let's open the island map okay so here we can see it clearly so this is where the actual high-res water mesh is you can see this box right here so this is where the meshes and this is the endless water mask so it's actually a low-res version of the same mesh so if you go to wireframe then you can see it's a low res mesh so it's not taking much of resources but it looks better from the distance so this is the actual island now since this video is getting long we'll create this island in the next video so i'll give you a quick run-through for now and you can create this island with everything i told today so you can think of it as your homework for now here i took the water body ocean you can see all these spline points i adjusted these manually so to do it quickly first choose all these spline nodes and change them to linear and then quickly add maybe 10 to 20 spline points around the island and refine those and maybe add 20 more finally when you're adjusted everything and then you can change it back to cow to give it a smoother fall-off and other than those we also have all these islands this is again the water body island you adjust the height and choose the spline points and then there will be this island so the reason i'm not covering the island in this video is because i also want to cover some of the texturing part of this one so that it's a little bit easier to place the water bodies where we want and to give you a bit of hint for the texting part we discussed the texturing a bit in the 100 kilometer square video so you can check that out to see how we did the texturing to show you where the layers are we'll search for the landscape and this is the landscape material and by the way this is a custom made material so all these parameters are already defined in its parent material so we'll search for debug and pick this use layer debug and now all the layers will have a different color so let me show you another map so this is the landscape and i haven't done any of the water on this one so i'll give you a quick idea of how to do it so since this one doesn't have an ocean it only has the lake and the rivers will go to the material and take the ladybug so now you'll see all the layers will have different color to make it easier i put the river as the blue color so you'll do something like this and then you will see this is where the river should be then you take the river and have the spline follow this exact path then you'll have the same river that you see in gaia into unreal engine and you have even final control with the spline tool now as for this material i'll put a simpler version of this into the description so see how the layers are set up i won't use any of the texture so it's smaller in size then you can add your own textures from mega scans to it that's all about this video and in the next video we'll cover the island
Info
Channel: Klaus
Views: 72,247
Rating: undefined out of 5
Keywords: ue5, unreal, engine, klaus, klauslyf, water, system, island, why you looking at tags like that, unreal engine 5
Id: MpCQc4sDMjw
Channel Id: undefined
Length: 36min 5sec (2165 seconds)
Published: Sat May 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.