Unreal Engine 5.4: Working with PCG and Water System

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys and welcome back in this video going to use a real 5.4 that was released last week to create some PCG content for those who doesn't know PCG it's a way to generate content inside of f real in a proced way so it can be really handy for all sort of things uh in this video going to focus in the very basics of the of the PCG and also how can we interact PCG with the water system uh since a PCG is often used to create environments know how to interact the water system with the PCG it can be really handy to generate environments really fast and that's it so let's go to real engine and start creating some cool stuff so guys we are here inside of on real 5.4 uh nothing Chang I I believe in the the interface the previous interface and I just uh I create a brand new project uh first things first if you like the way my layout is you just need to go here and load layout with for classic layout I prefer that better the other thing that we need to do to start using PCG in the water system so we need to go in edit and plugins here I need to type PCG as you can see all my PCG plugins are enabled so we need to do that as well so yeah we need to enable those plugins and the engineer will ask you to restart so we need to restart and then open the project again uh here we have the the default map of th real I think this map is too big I'm going to create a brand new level so I'm going to go here in file new level the basic template fine create here I'm going to delete this shape you don't need that and I'm going to create a landscape so I'm going to create a landscape over here and the default values are fine so we're going to go here and hit create I'm going to create Some Noise some heels to be a little bit less Theos so we're going to go here and noise not sure May two yeah I think it's fine so I'm going to just uh by the way this noise brush is really helpful to create some some heels and some some landscape so I'm going to do that just to not have a completely flat surface anyway I think that this way is fine other thing that I'm going to do is create a material so forest floor in our material graph uh I download a f surface going to use this Mossy ground I'm going to click and drag so texture sample uh roughness normal by the way guys uh I'm doing this fast because I have other videos explain that with more details so if you want to check out any of the videos to understand better what I'm doing uh feel free to to take a look in my channel H just because this video is about BCG so I don't want to lose a lot of time doing materials but yeah I just create these materials to be a little bit less tedious Y and here also I need to save my level so save my level as Forest PCG PCG [Music] save uh and here I need to find the landscape material then I put my my my material right now is look horrible I'm going to create just some texture variation it's really useful uh breaking the UVS so I'm going to break the UVS and to to the tiing won't be that appearance I just need to change one setting I need to change from n to derivative in M value mode and here shift UVS by the way guys if you don't want to see this material creation feel free to skip for other parts of the videos I'm just uh doing a initial setup be a little bit better but it's up to you so I'm going to hit apply now you have uh a little bit better the material yeah I think it's fine okay uh now let's let's create our I'm going to create a a lake and a river by the way if you never used the water system before uh I enable the water system and if you click here in the place actors uh I'm just dragging drop this water body lake so now we have a lake and if you want to change the the overall shape of the the lake feel free to do that you can hit uh can move the individual points if you want or if you hold alt while clicking some some points you can create more points and create a different shape so I create a lake over here and I'm going to create a river as well so here's the river sometimes the the point simply doesn't work the way that we expected so here I have this River I won't take much time doing something really fancy because it's not the objective of this tutorial but feel free to tweak the the river and the lake the way you seems fit so yeah so here maybe make the LI a little bit like that yeah I think it's fine okay now let's start with the juicy part the PCG to create a PCG uh I'm going to create a v PCG volume so if I click here in the play actors have this PCG value volume and you can see that right now it's really tiny uh right now it's really tiny and in the size in the size of the the PCG volume matters because they will SPO anything that you create procedurally just inside of this volume so let's make this volume bigger maybe 50 and then we can increase the size even more later if you want so right now we have the volume over here it's already pretty big but you you're going to grow this volume later so okay now that's the first step the the PCG volume and now I need to create a PCG graph so if I go here in the content browser right click and search for PCG so here's the PCG graph uh first PCG understand this PCG graph the same understand this PCG graph uh as a material editor or a blueprint graph uh they use like the the same logic the same approach so now that we create this for graph here in the volume we need to to go in the outliner and search for your volume it's over here and if you type graph going to type graph you can see that they are asking for instance a graph instance graph so I'm going to drag this graph and put over here we need to do that because here we have uh this PCG volume in the PCG graph it's like the controller so it's where I'm going to start creating logic and comments to tell this PCG volume what we need to do inside of this volume that's why that part is really important otherwise it won't work so we going to open the forest graph and the PCG graph that I called Forest graph and as you can see it's pretty similar to material graph or the blueprint graph if you're already familiar with L real and here we have the input and the output uh they Chang that in the version 5.2 and the 5.3 I believe you have a bunch of parameters over here uh but you don't have that anymore so the input and the output are being using now in the PCG graph uh to to put PCGS inside of PCG most of the time so we don't we won't use the input and the output in this tutorial but probably going to use them in future tutorials about BCG that probably are going to create because uh we are just going to scratch the surface in this video so here uh what do I want to do uh with this BCG uh well I want to create uh a forest with a few trees and this Forest will be around the lake and the river and then I want to create a way that the PCG understand that if it it's w water you don't want to SPO any trees any any rocks any leaves or any grass or anything that you want to put inside of the forest because it's a water so that's my My overall goal here and then let's go and start doing that in our forest graph let's create some some way to to create some points so the first thing that you need to do it's because you're going to use the volume directly in the our landscape so you depend the landscape to create our trees for instance or anything that you're going to create you need to go here and you need to use the note get landscape data so uh this landscape data you're going to search in your level for a landscape and then you have you can output several data from this landscape and the data that we are looking for is the surface because you want to place the anything that you want uh in the surface of the landscape so there is a note called surface sampler that's the that's the one and if I go here nothing will happen just yet and the first thing that we need to do it's I need to enable a debug mode so the debug mode is a way to change the the PCG features and the PCG logic in real time so you can see in the interface in the the level so if I click in the the node the surface simple and hit d uh that will be in the bug mode and if I go here in h generate as you can see that now you are creating a lot of points random points and I'm going to move around and change this points real soon so right now as you can see there is no points in the water but that's just because uh our volume is not deep enough so if I put our volume more close to the water you can see that going to start spawning points inside of the water as well so okay now that's the first step in the right direction but can do like much more things the first thing that I'm going to do is uh I'm going to create another node called transform points transform points and then I'm going to hit d as well and then I'm going to hit the in this surface sample just to let the the real time logic just in the transforming points the transform points it's other really important node in BCG because you can randomize uh how the points are being spawn so if I go here have the rotation minimum I think zeros makes sense in the rotation Max so if I put here 360 in the z-axis you can see that all the the points now are are randomly rotated from 0 to 360 and that's already generates some Randomness which is often is really useful to create environment uh other thing that we can do it's the scale I'm going to change the scale the minimum scale for 0.5 and the max scale to 1.2 and then we can see that all the points uh have different scales so we can randomize even further and this way you can run on M so now the cool thing that with those just those three notes we already can Spa any match that you want using these points in the level so if I go here and use another node called Static MH spaer then I'm going to hit the nothing will happen just yet and I'm going going to go in the mesh entries and hit the Plus button in the index in the description have here a option to select some mesh so I'm using the European hornbean assets it's like a really good quality Mexicans trees that you can download for free in the marketplace so check it out I have a a lot of horing trees over here so it's a pack and it's for free so take a look in the marketplace of from real that you can find it so and I'm going to hit the the field one I think it make sense and now you have Forest right now it's a really dense forest and you have just one kind of tree so other thing that I'm going to do here uh in the surface sample I going to change the scale so I'm going to change from 0.1 to 0.05 maybe even less so here it's amount of points that to be spawned per meter so have 0.01 and then you have a files it's not that dense so it's better and now I can go back here in this historic spawner and I can create another array element and go in the descriptions and search maybe for another kind of tree maybe this I don't know which one but I don't know maybe this one so it might take a while but now you can see that we have two kind of trees they're randomized by scale by rotation and feel it's feeling really natural refect click play over here and take a look walk around you can see that it seems like pretty handome of course you need to put more stuff in the forest but you already have a good amount amount of trees and they look like really handle as a forest and that's pretty cool because you use like three nodes four nodes and you already have that so it's really fast and if I go here in the volume and I scale you can see that we can scale the size that you want and you're going to have a lot of trees a matter of a few minutes we have a forest and again if you hit if you go here to play you can see that all the the trees are place exactly in the landscape so it seems fine and you have a lot of trees and you keep adding so if you want to keep adding more and more elements to this array and you're going to have different kind of elements because if I want for instance go here and another another element so let's search for some [Music] rock oh B maybe Boulder too maybe this one let's see now we can see that you have a few rocks as well these rocks they are just placeholders but you understand what we can do so we can add more and more more things in in our project to make really believable if you want and also you can do some stuff procedurally other things uh not procedurally so we can mix mix the two approaches and you'll be even better results and now we have a problem if you see because you have the trees and everything that we spawn in the river in our in our lake so let's solve this problem so going back here in our in our PCG graph uh the thing that we need to do it's get spine data why am I I'm searching for spline data because if I go here and click in our River as you can see it is a spline the same thing for our lake is a spline so you need to somehow grab the information of this spline so cat spline data and here if I click in the expain data I have act actor fter have all World actors and here we have the option by tag which is really useful but we not talking about that in this video just because you can create tags uh but you'll be let's keep simpler and use by class in by class I can search for Lake and then you have the water body Lake uh because you have just one L it's fine but you if you have more legs you need to select multiple and here you can go and use the what you need to do need to sample the the SP the Spy line so I going to search for spy line sampler and then and then what we need to do we need to create a kind of a mask in our landscape with our spline to tell the spawner over here that in that mask uh we don't want to place any trees so we already have this planine so the old alter nodes that you need to use is the projection noes so the projection node will project the Spy line directly in the projection Target so the projection Target in this case will be our landscape and then if I hit d and go back to our level you can see that you have some lines around our Lake because you are projecting the Spy line in our landscape so so far uh we are doing exactly that what we want but you have a problem because you don't need get just the Spy line area you want everything that's in the interior of the this py line because the lake is happening inside of this the this py line not around this py line so to change that you have a option in the the graph this spine sampler which is the in dimension you have the on interior so if I go here now we can see that our spy line it's thicker because it's projecting all the lake and then okay now you have the information that we need you have the projection that we need so somehow you need to to subtract this projecton from from the surface sampler and to do that there is another node called difference so if I go here the source is the surface sampler and the project will be the difference and then instead of use the surface simpler in the transform points I use going to use the [Music] difference and if I go here we don't have any trees in the lake anymore so going to disable the projection and you can see that now you have any rocks or anything that we spawn in the the lake and that's great because now we can create forest and put any amount of lakes and you won't have any problems uh you're going to save a lot of time uh removing manually all the trees and now we have the same problem uh with the river the approach to do to solve this problem in the river is slightly different but the train of thoughts pretty much the same again you need to get the spyine data but instead of the lake now we need to search for River where is the river what water river and then again you need to create a spline sampler but now as you can see you already have a error even if I go here and create the projection node that you need to project the river and use the landscape data you can see that you keep having this error because if to use the interior in the dimension on interior as you did with the lake you need to use a close closes spy lines and the river is not closed because you have a spyine that begins here and ends here different from the lake that's a closed loop so we can use the interior so we need to have a water way to solve the same problem and to do that is not that hard so I need to go here and put in spy line and I need to use uh before the projection another node call Bounce mode fire uh if you go here you can see that now it's projecting the just a spy line but it's not the same thickness of our River and that bounce modifier uh I can see here that you have the bounce minimum and Max and then it's just a matter to tweak the values so if I go here as you can see that now our projection is growing bigger the easiest way to see uh which scale you need to use is just go here in the projection create another difference node because now we need to subtract the projection of the river by the surface sampler as we did with the with the lake but we already have this information over here here we have the the surface sample subtracting the the lake so I'm going to grab this information here put as a source and then I'm going to put the difference over here and now uh instead of use this difference in this node I'm going to just cancel this one and I'm going to use this difference over here and but right now we see that our problem problem is not solved yet but now we can tweak the scale of our bounds and that going to be update in real time so we can see which values make sense to us to use so going to keep tweaking these values now we can see that we start not having the trees anymore so still have a few trees and now now as you can see we don't have any trees or any rocks in the river as well and doing that you can generate any Lun environment that you want so just need to spawn and make those tweaks and maybe if you wanted to create a really good uh really good environment you can mix the the procedural thing with some manual thing uh probably big projects going to use both because you can do all the heavy lifting and all the boring stuff using the PCG and make the tweaks and that 20% to make your level environment good using manual or other technique other than procedural and that's it guys with that with those uh tools you can use the water system together with the PCG without any problems and with those nodes you can create other kind of stuff you can Spa other kind of environments um any mhes and assets you want to SPO uh in the any way that you want so that's it for this video guys uh probably are going to create more and more videos about PCG because I'm I'm playing a lot and I think it's be a really useful tool and probably are going to create more advanced topics in the future so see you in the next video and thank you for watching
Info
Channel: Unrealverse Labs
Views: 3,627
Rating: undefined out of 5
Keywords:
Id: 4tRMmdUhuNA
Channel Id: undefined
Length: 29min 52sec (1792 seconds)
Published: Wed Mar 27 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.