#UE5 Series: Using Procedural Foliage Tool in UNREAL Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone Reza here welcome to my channel we're here with another Unreal Engine tutorial and in this one we're going to take a look at how the procedural foliage tool works over the course of this quick start tutorial we'll learn how to create setup and spawn an entire Forest worth of trees inside Unreal Engine 5 using only the procedural foliage tool you'll be also introduced to the Key properties and settings that will help you to shape your virtual Forest that fit your projects needs we have a lot to cover let's get started [Music] before I jump into Unreal Engine I need to basically finish off what we started in our previous video making trees fast in speed tree so we hopefully you all watched this video we went through from start to finish how to create a product like this now all you need to do is to export it out using the native export command inside speed tree now based on your version either it's Cinema or games you have slightly different ways of doing this if you have Speed 3 games you can actually enable wind so I can go in there and basically enable wind and then give it a particular rate that I like and I can export this wind as well so this will be baked into your SP file and you can sort of bring this tree inside Unreal Engine and it moves as well but what I have is Cinema so the walkthrough is slightly different in games you have file export to games but in cinema you have export mesh you have VFX you also have games but this one does not export your wind simulation so I can go in there and you have fbx you have Speed 3 SDK you also have Unreal Engine and that's something that we want is D9 if you use the using older version you probably get SRT but pretty much does the same but you can see the warning here that because you're not using the game mode you cannot export the wind but that's fine we're not going to export the wind we're just going to export bunch of trees and we use the foliage tool that would be the purpose of this video all right with this out of the way I'm going to close speed tree switch to Unreal Engine and see how we can use foliage tool to our advantage and populate this vegetation across our terrain quick disclaimer I'm using my own speed tree instances but if you don't have access to those you can definitely go to open world demo collection in epic games and there is a free sample that you can use and it works just fine and gets the job done so you really don't need to download anything else to follow along you can just download this add this to card go in there and check out and the good thing about that it is compatible with 5.2 so there's something in there hopefully you can bring this to use also for my Terrain anxious for the sake of demonstration I'm using a riverology by gallauder and it's a paid instance so unfortunately I won't be able to share this video well but the good thing is you still can practice the techniques even on a flat surface so I'm using this for the demo but it just create a simple terrain inside Unreal Engine and you can easily follow along learn the tools and use them in your own personal projects Unreal Engine now this particular scene actually comes with trees but I removed them because the whole purpose is actually to add trees so I have just a landscape the train a bunch of assets scattered around and I'm planning on using procedural foliage tool to be able to populate them across this train now uh prerequisites before you can use procedural foliage tool in your project you must enable them using your editor preference so let's see what we need to search for we go to edit editor preference in here we have under General experimental you can click on that and find what you're looking for on their foliage procedural foliage and make sure this is ticked it can of course search in the search bar that brings the tick box and make sure that is ticked because that will add to your foliage toolbar and you will have then necessary tools to be able to scatter your assets around your train so definitely keep that in mind all right also apart from My Level I have a foliage folder where I create my actors and static meshes for my foliage and I have a speed tree Library where I bring all the necessary trees and add them to my scene now the first step regardless of the method that you're using is to create a static mesh out of your speed trees you right click inside the content drawer you go to foliage and you have two tools to create a static mesh foliage one is actor foliage and the second one is static mesh foliage and both of them will ask for your speed tree model so it is important to have a speed remodel somewhere in your content folder so you can point to them and attach them to your foliage you may say resup what is the difference between the two because actually they do exactly the same and they can be at times a little bit confusing Dr foliage comes at the same rendering cost as placing a normal actor into your scene just imagine how many objects you may Place into your scene I'm based on that it can get very expensive really quickly as you can imagine so if you have one tree if you have just a small garden to fill probably you wouldn't be picky but if you want to create a forest I highly encourage you for optimization's sake not to use active foliage instead go with static mesh foliage and the good thing about static mesh foliage is it uses hardware instancing and many instances can be rendered with a single draw called and you can imagine how much processing time you're saving using this static mesh foliage and you may be wondering you know if it's a more difficult approach than actor foliage definitely not they're pretty straightforward just keep that in mind by the way that once you export out your speed trees if it's let's say a single instance you can definitely drag and drop them into your scene so I can just go in there drop this guy I'm going to frame it bring this forward here and say you know what is just one tree I'm trying to place and uh there I have my tree and the actor foliage kinda does that so it actually brings an asset or an actor into your scene and each one of them will create a node inside the outliner and will get calculated uh obviously that is not the approach that we're looking for and for the sake of optimization we are going to use the second method where we're actually going to create a foliage static mesh to create our speed tree instances so to create our mesh instances we just need to pick what tree we are going to use the first one I'm going to use is American Sycamore met for medium so I'm going to go into foliage I'm going to right click foliage static mesh foliage and I'm going to put SM for static mesh foliage in front of it I'm going to double click on it and it says all right you have a mesh instance in situation going on where is the foliage I'm going to go into speed tree pick the medium that I want or any asset that I want and click on this apply and you can see it applies this to my static mesh just make sure to check align to normal and random yaw now this section sort of dictates how your foliage type is placed on objects on your level so if I go into my foliage you can see now I have the first static mesh foliage tool created and if you wish to add more to this collection and add variety to this collection then by all means go ahead and add more to your static mesh foliage tool I would say you know three four five instances would be a good number and that allows the foliage tool to randomize those based on the density that you specify and if you want the entire Forest to use only one mesh instance then in that case probably one will do and you can sort of now move on to the next chapter now for the sake of having a bit of variety I'm just gonna speed up the video I'm gonna add three or four more of those into my scene so I get to have a little bit more variety using the exact same method [Music] thank you [Music] thank you [Music] foreign [Music] now once this part is done you have two main tools to scatter your trees around you have if I go to my foliage foliage procedural foliage spawner and in the mode drop down you have shift 3 foliage mode we're going to explore both of these methods it's just a workaround there is really no right or wrong way and I will show you how to approach both methods and you pick which one works for your project [Music] let's take a look at the first method procedural foliage spawner how to create it and how to tell the spawner what to spawn that's actually fairly straightforward I'm gonna go and use this foliage folder and I'm create my foliage spawner within that folder so I'm going to right click go to foliage and procedural foliage spawner PFS is a type of name that I'm always using for this particular node I'm going to call that forest and you can see there is nothing in my outliner just yet because we need to pick an area and then tell the procedural spawner what to spawn so let's go ahead and pick an area probably somewhere around here is a good flat area to use let's actually pick this region it's fairly flat and we can definitely use that I'm going to uh sort of fine tune my camera angle now let's go in there and just drag and drop it in here and now with a simple transform node w e r I am going to generate my boundaries try not to over extend your boundaries and make sure it's going inside your terrain but not too deep because you don't want to create vegetation underneath the ground and just add to your computational time so let's say that this is the area that I would like to cover I'm going to expand that ever so slightly and move it forward and you may have noticed that now I have a PFS forest in my scene and now we need to move to the sort of next step and tell the spawner what we want this to spawn to do that we're going to double click in the content browser open this FPS Forest window and you can see right underneath everything else we have foliage type zero array elements it says that well I have the boundary box I do not have any elements in it well let's create one I'm gonna go and probably instead of picking all of them I'm going to pick two for the sake of demonstration so first you need to select and create an element so click on this plus to add an element now we have a container and we can drag and drop our elements in there with the element selected I'm just going to say you selected and I'm going to go and pick the second one creating a new element and use selected let's say for the sake of demonstration I just want to use these two types or elements within my procedural foliage spawner now I have an element in the scene I can now make use of its details window for this particular mode to re-simulate so once you select that you need to look for procedural foliage and within that procedural foliage we have a re simulate that is a very important window and every time you go and change certain attributes within your static mesh you have to go back and re-simulate it now if I click on re-simulate you can see it creates certain elements within this bounding box and region now the reason that the density is low because I've already gone ahead and tweaked that inside my static mesh and that's a very very important thing to do uh if I double click on my element and go into procedural and I'm going to scroll down until I get to clustering you can see I set my initial seed density to 0.25 and the default value is actually very very high so if you would like to spawn your elements with the default value you get a very packed super dense area full of trees and they're all colliding that's why it's a good practice to go before you simulate and just reduce them ever so slightly just to show you what happens if I reset this value to 1 which is the default value and go ahead and re-simulate you can see the density is out of control now this may be something that you want but in a large environment you kind of need to go a little bit easy on this especially if you don't want 4 coverage like that if it's an aerial shot where you would like to see just trees maybe that's a good idea but in general I just go into individual static meshes and I try to sort of find a happy spot in here so maybe point three for my first static mesh let's see what I have for the second one so I'm going to go in here yeah that is close to non-existent so I'm going to go and just use point one on the other one and you can see every time I make a change I'm gonna go and reassimulate and I'm getting a slightly different density so that's pretty much how you use this tool and while it's pretty good and you get the job done beautifully the only issue that I have with this is to control the density you cannot use this you need to go in to in individual static mesh and tweak them manually and that can be a little bit time consuming otherwise when it comes to optimization and efficiency this is a great tool to populate your assets uh around your landscape you can see I have static stationary and movable to make this fully dynamic or to make this static but well it computes everything a lot faster and all The Usual Suspects that you usually get with any procedural nodes inside Unreal Engine but of course this procedural foliage drop down is probably the most important one to be mindful of now we know how this works and it's fairly straightforward let's go to the next chapter and I will show you the second method of creating exactly the same thing [Music] now we're comfortable with foliage spawner and we know how to use it let's look at a similar method to populate Assets in a large scale environment and that is using foliage mode so right now you're in select mode you can press shift 3 to switch to foliage mode and as soon as you do that everything in your outliner Grays out because now you're focusing on planting your assets and scattering them using this node you're no longer in the select node now we have a good set of tools that allow you to quickly paint and erase your static meshes and your actors and basically filter them how you want to scatter them don't place them on certain objects so much control to populate a larger environment with foliage in a very short amount of time now let's look at the controls that we have and see which one does what so we have the tool palette and this tool palette provides you with tools to paint remove and select your foliage you have brush options and this brush options allow you to tweak what's in the brush the density of it so unlike the foliage spawner where you had to go into the actual static mesh to reduce the density we have the density right here and I intentionally lower this density to a very small amount otherwise the original value it's actually pretty dense and you may run out of memory so definitely reduce that before experimenting with everything else you can tweak around with this erase density to erase foliage from your landscape you can filter what you would like to use to use your foliage you would like to place the foliage in your landscape yes on top of static meshes into foliage on top of the foliage and if you have geometry with translucency you can take that off saying that all right all I want is landscape just place them on landscape then you have foliage you can add either a static mesh foliage or an actor foliage you can bring them here you can see my static meshes are appearing here well an easier way is just to drag and drop all of them in here like so so by default not this tool is not going to work you can see I'm just trying to paint and nothing is happening I'm not giving given a presentation of my falloff for my brush simply because we haven't included our assets we have a good collection you may have double the number but you may not necessarily want all of them into your falloff brush to paint and you can see gradually but surely how much control we get compared to foliage spawner tool let's say for the first pass I just want to include three of them I would like to include Sycamore I would like to include Elm and I would like to include a Gumtree now I'm getting this foliage now everything that I paint will have these three Assets in there or three elements in there let's say that's what I want to get a little bit of coverage in the background so what I'm going to do is I'm going to go in here I'm just gonna add a lid a bit of density let's say I don't want this I just want to have two and I'm starting to paint these assets right here you can see how quickly I'm getting a coverage let's say I want to add this one to the mix and go in here and you can see very quickly I'm getting a coverage I can do the same thing this time I might include Maple and I'm reducing this to .001 and I have I'm going to start with some paints now within those you can see I'm getting too much yellow in here of course you can always undo within each brush you can dictate how much density you can use within your falloff let's say for this one I want to use only 20 and with this one I want to just use 25 for this American Sycamore I want to use 100 for this 100 I'm not including this or this I can actually bring this one to the mix and start populating based on my need now you may have noticed that if I could scroll down on each asset to see its details it automatically brings a static mesh foliage property for me in the same window so I have a line to normal we want that to be ticked a little bit of randomization with random yaw we can do that static or movable so static gives you speed whereas movable give you a fully Dynamic result when you're in gameplay we all know that hopefully you have watched my lighting tutorial and you have some controls for your shadows so you want to cast Shadow here or cast contact Shadow if you want a little bit of control over Dynamic indirect and distance light field in case if you wanna bake lights so the rest is fairly self-explanatory I can see I'm just painting if you feel like the density is a bit too much for certain elements you can always select that and let's say reduce that to something like five so I get close to no um of these trees within the brush now let's say you want to use a single of these so I'm just going to get and add a little bit more density in here and a little bit more density in here I'm trying to find a good coverage at least for the background so a little bit of that here here and maybe slightly um a bit more in here so let's say this is good enough to get me started and this is my first pass but now I want to Art direct this furthermore I want to place certain elements let's say in here but I don't want to do it like putting the whole brush in there I would like to have a little bit more density but in a a directed way let's say I want a single tree here well one way it should just to drag and drop a single speed tree here but remember if you're going that way it's no longer mesh instancing you're bringing a brand new actor and that can be expensive so there's a tool for it here it's called single place a single instance of your selected foliage all I need to do is to pick one from this collection so let's say I wanted this fall um gum tree and I'm going to deselect all of them it is important to deselect all of them otherwise it's going to place a single of each on top of each other in the same location so if that's what you're looking for or maybe let's say this one you just select the mode to single and you single click and that is going to Art direct it for you it is still a single instance so you're not really paying any price it's not expensive and then if you want then you switch back to brush paint include more and continue with your paint to add more density it is really that simple and I really truly like this method when it comes to vegetation and populating assets populating foliage in your landscape this is definitely one of my favorite methods and then for the second pass you can just continue with with the coverage I can actually enable that bring it a bit uh higher this density value and you can just go around and based on the filtering that you have then you decide what exactly you're painting how you're painting it so on and so forth so very intuitive really incredible way of looking at your foliage and basically specify what you want or you don't want in the scene and take it from there so this is really it that is going to basically do the trick for US based on your camera you're going to include or exclude you can erase you can deselect all of them or select all of them and do whatever you want with them you can lasso select them so basically this tool palette allows you to edit what you already have in the scene you change the settings of each foliage when you select them and in filters and brush you basically specify what exactly you're painting on and with what density and that is it once you're done you switch back and I'm just going to fix my outliner right here and you can see we don't have any manual actors placing in the scene and that is it you set up your composition you can even throw in a camera sequencer I'm just zooming at the moment but you can definitely throw in a camera sequencer animate the sequence make sure that your density works for you you're pressing Ctrl L using light shaft and add to the drama of your scene and take it from there now truly you found this video useful use these techniques in your own projects right now I'm trying to fine-tune my light shaft and got raised to see if it's working for me but of course I can spend hours in this this video was our last and final video of this year and it I think it's a great moment to thank you all for all of your support and all of your great comments and feedback it's a community and we want to grow together as artists so I hope you found this video useful and use it in your own projects let me know how you go in your comments below and if you have any questions definitely let me know have a great rest of your day happy New Year in advance and wish you a successful year ahead until the next video see you guys later foreign
Info
Channel: SARKAMARI
Views: 2,657
Rating: undefined out of 5
Keywords: unreal engine, unreal engine 5 tutorial, unreal engine tutorial, foliage ue5, foliage unreal engine 5, foliage unreal engine, procedural foliage spawner ue5, procedural foliage spawner, unreal procedural foliage spawner
Id: xhJLBoSl4gw
Channel Id: undefined
Length: 33min 42sec (2022 seconds)
Published: Wed Dec 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.