15 Minute Photoreal Warzone! Procedural Content Generation PCG in Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome in this video I'm going to be teaching you how to make a photo real war zone in 15 minutes and we're going to be using the PCG tool and we're going to be putting a bunch of free assets from qixel bridge into that to build our environment so let's get into it I'm going to be starting with a completely empty environment here I'm going to kick start my lighting scenario by using the ultra Dynamic weather asset which I will link below this video and I've already downloaded it and added it to my project I'm going to come over here to the ultra Dynamic Sky folder and I'm going to come over to Blueprints and drag in the ultra Dynamic Sky blueprint asset once I've done that I can add some weather which is going to provide the basis for our Moody Warzone environment and by doing that all I need to do is drag in the ultra Dynamic weather environment as well by default it will already be raining inside of the asset and all I'm going to do is come over here and make sure I increase the fog now that we have a moody foggy rainy environment I'm going to make the landscape which is going to be the basis for our our war zone environment when I come up here to the mode drop down and choose landscape the material for this landscape we're going to download off of quixel bridge and you can find almost all of the assets that I'm using here under qixel bridge under the collections tab in environments natural burnt Forest you can find all of the assets that I'm using here so I can find that in mega scans under surfaces and one of my burnt forest floor materials here which I'll drag in once I have my material Dragged In I can go ahead and hit create now that we have our ground set up we're ready to set up our PCG volume in order to simulate our assets like rocks grass and trees the first thing I need to do is make sure that I have procedural content generation framework enabled as a plugin and I can come up here to the edit drop down choose plugins and type in procedural content generation framework here and this is what I want to make sure is enabled if you need to restart the engine after you turn it on go ahead and do that come over to the content browser and right click in the empty space and I'm going to be coming up to PCG here and choosing PCG graph I'll call it PCG underscore war zone and let's drag that into our environment okay so once our volume is in there we need to come over and double click it to open it so we can start setting up the logic for our volume you're going to see two nodes here we have an output and an input the output node is not important for our purposes in this tutorial but the input node is and if we hit this little drop down arrow here we will see a bunch of different types of data that we can use in our graph so the one I want here is called landscape so I'm going to pull off of landscape and type in Sample and the type of sampler that I want is called the surface sampler which is going to take points sampled on the surface of our landscape we can actually see what the service sampler is doing by coming over to the PCG asset inside of our environment and hitting generate you won't see anything right away but that's because we need to first come to a node inside of our p PCG volume that we want to look at and hit d d stands for debug so now if I zoom out here we can see these little cubes which are representative of the points that are being sampled from the surface of our lens so let's use these points to simulate the trees which will be the first assets that we're going to add to our world in order to prepare these points to simulate the trees we need to do a few things the first thing I'm going to do is come over to the surface sampler and drag off of it and add a density noise if we look over here at our cubes there are a bunch of different colors ranging from white to black each of these shades of white to black represents a density and by making sure that we have a density noise we're making sure that these cubes have a value on this density scale now this is not density in terms of spawning geometry but we can use this density for is to cut out some of them and control how many points we have on our surface so dragging off of the density noise here we can create a density filter and if we on hit D on density noise and hit D on density filter and if we look over here at our lower and upper bounds you'll see when I start to change my lower and upper bounds I'm cutting out different ranges of density of the points and this is a really fast way to control how many points we are simulating on our surface or how many points we're using later on in the graph so now that we have a few less points on our surface we need to make sure they have some random rotation to them because we don't want all of our trees to be pointing the exact same direction so I'm going to pull off of the density filter and add a transform Point let's go ahead and look at that node now you'll see nothing changed right away but what we need to do is come over here to the rotation Max right here and each of these boxes represent an X's so coming from left to right we have the X Box the Y box and the Z Box and the Z axis if you can see here in your environment is the axis pointing directly up so in order for our trees to rotate around the z-axis we want to use this z-axis box so I'm going to add a 360 into the rotation Max and now all of these points are rotating a random value between 0 and 360. so now we're ready to start adding the actual tree geometry at the end of this graph so I'm going to drag off of the end here and type in mesh and what we want is static mesh Spa here in the static mesh spawner on the right here if we click on it you can see that there is a mesh entries section we're going to click the plus button next to the mesh entries section and if we expand index and descriptor this is where we can start adding actual trees so I'm going to navigate over to where I've saved my trees these trees are part of the black Alder pack which also is free and I'll link below this video I'm going to drag this tree in and suddenly the trees appear in our environment to add a little bit of variation let's add a second version of the tree so if I contract my index 0 here and I add another mesh entry and expand that one and drag a second Tree in now we have a second version of a tree which is randomly spaced between the first version if you want to add a little bit more randomization to these placement of trees what we can do is come over here to the transform points node and add a little bit of random scaling so I can come over here to the scale Min and Max section and maybe increase the scale to 1.2 and lower the Min to 0.8 now the scale of the trees will be a random value between 0.8 and 1.2 and if you're curious about learning more with me how to use Unreal Engine as a filmmaking tool or to make animations and visuals things like that check out my free training below this video which is all about doing that how to make a film in under 30 minutes so now that we have our tree simulated in our environment it's time to add a little bit more geometry to the ground to make it it look a little bit more realistic and I have downloaded some geometry for just that purpose I'm going to be using the Nordic Mossy grounds geometry which you can also find in qixel Bridge and in order to simulate those pieces of geometry I'm going to go ahead and duplicate a large chunk of this crap so from the surface sampler to the transform points I'm going to control C and Ctrl V to copy them down below we're going to hit D to look at those particular points and I'm going to come over here to the surface sampler and since I don't want these to be exactly where the trees are because we duplicated those nodes I can come over here to the seed value on the right side and drag it over a little bit to position them slightly different now I'm ready to add a little bit of geometry at the end here so I'll drag off and add another static mesh spawner and come back over here to the mesh entries drop down come to descriptor and I will drag in the Nordic Mossy ground geometry let's come over here to the transform points and and click on it and hit D to stop looking at debug mode now we can see our new pieces of geometry on the ground which are giving a little bit more realism except that I want more of them so I'm going to come over here to the density filter and scroll up here to the place where we set our lower and upper bounds and I'm going to increase our upper bounds a little bit and that's going to create a lot more of those ground plates which is going to help fill out our ground now it's time to add the dead burned out stumps from the trees that have been destroyed during the fighting in this war zone so I'm going to go ahead and grab this exact set of nodes duplicate them again plug them back into the landscape output in this static mesh spawner we're going to go ahead and navigate to the geometry that I downloaded from qixel bridge that are some dead stumps here so I'm going to drag in this piece of geometry and we're going to go ahead and add another mesh entry and drag in another one and go ahead and hit another mesh entry expand the descriptor and drag in another one and now we have a nice mix of dead trees if you want to modify how many of each type of tree that you have you know if you've added four different meshes to your spawner and you want to modify oh I want more of this tree or that tree you can easily do that by Contracting the descriptors here expanding the index and here under weight currently we have a weight of one for each piece of geometry but if we wanted to have a lot more of that first piece of geometry we could just increase this to 10 and maybe increase the second one to two and this would weight those geometries accordingly and this is an easy way to take existing forests or setups that you have and really mess with the Feeling by just modifying how much of each type of tree or asset that you have in your environment finally let's duplicate this maybe one more time and add some Fallen logs on the ground so go ahead grab these points and duplicate them again connect them up again come over to the static mesh Runner and under the descriptor we're going to change the meshes to be these logs that are lying on their side and this one this one and I'm going to come back over to the surface sampler here and update the seed so they're in a slightly different position and I actually want to increase the density as well so I'll increase the upper and lower bounds to add a lot more of them now if you're coming to a situation where you have a certain amount of assets and you've maxed out your density filter here you can always come back to the surface sampler and under the points per square meter here is where we can adjust how many points we're starting out with so if you get to the point where you you know your density filter is from zero to one so you have all the possible points in your environment and it's still not enough you can always come back here to the surface sampler and increase this to let's say three or maybe even ten to increase the number of points something I will point out though if you are increasing the points per square meter but you're not seeing more points it could be that your points extent here are bumping up against each other because it's not going to simulate two points on top of each other so in order to check this since I've increased this number and it doesn't really look like I've added additional stumps or Fallen trees to my environment I'm going to go ahead to the surface sampler and hit D and you can see that these meshes are actually pretty big the cubes that represent the data of where the mesh is placed is pretty large so it's not able to create more of those cubes because they're too big they're bumping against each other so we can come over here to the points extend and start to lower that so if I lower that down to one by one by one suddenly we have way more points here in fact too many so now I'm going to come back to the points per square meter and drop it down again maybe one or two now we have a ton of Fallen logs which look really cool so now now it's time to add the final piece of the puzzle and that is the craters imagining that a bomb went off in this environment and the crater is what's left over so I've downloaded this geometry as well from Quixote bridge and I'm going to navigate to it and it's the Iceland volcano geometry if you want to use it as well I'm going to duplicate these nodes one last time here and I'll actually choose the second to last node since I don't want to have quite as many I'll plug in the surface sampler to the landscape again and let's delete the static mesh spawner and add a new one and before I actually add a mesh in I want to check that there's only a few points in our environment so I'm going to come over here to the density noise and filter and I will go ahead and debug the transform points by clicking on it and pressing D and my density filter I'll adjust till there's only a few in our environment here that looks pretty good so now we'll come back to the transform points stop debugging it come to the static mesh spawner and we'll go ahead and add our piece of geometry which I have downloaded the Icelandic volcano terrain if you'd like to use it yourself by default it's super huge it's larger than in our environment but we can always adjust that by coming over here to the transform points coming to the scale Min and Max and lowering the scale Max to something like 0.5 maybe and the scale Min to 0.4 maybe that's even still too big so we'll come over here maybe lower it to point scale Min 0.2 and scale Max 0.4 and in order to make it fit the environment that I'm building I want to actually adjust the scale in the z-axis as well so I'll come over here to the static mesh points here so this is looking pretty good I just want to make sure that these assets blend well together and for the most part they are except for this plate geometry that I have down here is not exactly matching the color of my craters that I added and I think I like this dark color from the craters a little bit better it's much more Moody so I'm going to come over here to that geometry double click it to open it and open the material assigned to that geometry and since it's Sim simulated through PCG I only have to change it on the base asset and it will then be populated throughout my environment so I can come over here to my Albedo tint here and my Albedo controls I might tent it to be a little bit more green just ever so slightly and under my Albedo controls I can lower the brightness quite a bit and that will you'll notice will start to blend it much better with the dark Earth of the craters that looks pretty good now let's increase the size of our PCG volume to simulate a larger area so come over here to the PCG war zone when I make changes like this that are going to increase the size of the volume itself I find it a lot more helpful to first come over to the asset here and hit cleanup this button will suddenly stop the PCG volume from simulating foliage and now I can actually increase the size much easier so I'll increase it to 100 by 100 by 40 here now if I come over here and hit generate again it will generate my environment much more quickly than it would have taken to try to scale the volume at the same time as simulating the stuff inside of it I've had my computer crash quite a few times trying to do this and I found this approach to be a lot simpler and faster we have all of our objects being placed pretty well separately the problem is that there's no logic to tell them not to overlap with each other or have a tree growth right through the middle of a crater which is what we have happening right here so we need to build that logic in the first thing I'm going to do is come over here to my sequence of nodes and we're going to be adding a node in between here at the end of all the logic that I've already added right before the static mesh spawner I'm going to hold alt and click on the out button here to disconnect it I'm going to drag off and type in bounds and what I want is bounds modifier and we'll plug that in instead now if I click on that node and press D to debug it we can see that there are cubes again for the placement of trees and what this node is doing is it's going to be able to modify the size of those cubes which we can then use as logic to make sure that they don't bump up against each other but since we've done a bunch of logic to the shapes and sizes of all these various objects since sampling the surface some of those cubes might end up not being the right size by the time we get to this end point here so I'm going to add this node at the end to kind of resize or reset all of these objects bounds which is why it's called bounds modifier to be roughly the size and shape of those objects come in here to the bounds Min and Max here and just adjust it so if I wanted to increase the height of these trees I could just go ahead to the x y z field here and type in 10 and now I have tall cubes for the tree so I'm going to go ahead and do that for all of the objects okay so now I've set the bounds for each of my objects I have my trees here I have my ground plates I have my stumps and I have my logs and finally my creators now at the end here all we need to do to tell the trees not to grow in craters is we're going to drag off of the trees up here and we're going to create a difference node and we're going to make sure it's plugged into Source here and out is going into the static mesh spawner and in differences here we can plug in all the things that we don't want it to grow on top of and since we set the bounds for each objects we know when they're overlapping okay so I'll drag in my craters here into the difference and you might not see a change right away but that's because we need to come into the difference node here and choose the density function as binary which basically just means it can either be only one or the other so now you'll see that there aren't any trees growing on top of the craters now I want to do this also with the stumps so I'll go ahead and make a difference node after the stump object and I'll plug the differences into the crater as well now we have no stumps growing inside of the crater okay so all our placement is done I want to show you one little bonus here and that is how to simulate fire on every single crater that you have already placed based in your scene it's extremely easy to do and adds a lot of atmosphere so I can come over here to the end of the crater here and drag off of it right before the static mesh spawner and I want to create a transform points and then drag off of the transform points and I want to add a spawn actor in the transform points I'm going to give it a random range from 0.2 to 5 in the scale and in the translation I'm going to make it move up 50 units so it's at the top of the craters and then give it a little bit of room to move around so maybe uh negative 30 to 30 and negative 30 to 30. okay so that's our placement data now all we have to do is connect our Niagara fire so come over to the spawn actor and under the template actor class I'm going to drop down and type in Niagara and I want to choose Niagara actor and under the option I want to choose merge PCG only now I can come to the Niagara actor here expand it come to Niagara comp and then Niagara and now we have an input here to put a little fire simulation so if I come over back to my fire and I drag in my Niagara simulation you can see it's now duplicated and put it at every single crater that I have placed in my environment and there you have it that's how to make a photo reel war zone environment if you found this video helpful throw me a thumbs up so I know how to make more videos like this and if you want to keep pushing this environment further I have another video right here which you can learn how to make effects like gunfire shooting through the environment randomly to add extra level of excitement and danger to your environment so I'll see you in the next one
Info
Channel: Aziel Arts
Views: 9,575
Rating: undefined out of 5
Keywords:
Id: kA9_K5qU_jQ
Channel Id: undefined
Length: 19min 21sec (1161 seconds)
Published: Sun Aug 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.