How to Add TREES to Terrain in Unity!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys justin here with the realtimeessentials.com back with another unity terrain and landscape tutorial for you so in today's video we're going to talk about how to quickly place trees on your terrains using the paint trees function so let's go ahead and just jump into it so last week we talked a little bit about how to create terrain inside of unity i will link to that video in the notes down below in today's video i want to talk about how we can use the terrain tools in order to paint trees onto this terrain so you can quickly add trees and vegetation into your scene and so for this video i'm going to be using the free speed tree unity asset pack so i will link to this in the notes down below so this is a sample pack from speed tree the trees are set up with lods and so we're not going to worry too much about that for right now but this is going to be a good sample pack for us to use so first thing we want to do is i'm going to go into unity right here make sure that you've imported or you have whatever assets you're going to use inside of your assets down below and so basically what we want to do is we want to place some trees on the surface remember up till now we've used the paint tool right here well now we want to focus on the paint trees tool so we're going to use this option in order to select the option to paint trees and so notice how when we click on this this gives us some instructions it says to click to paint trees hold shift and click to erase trees hold ctrl and click to only erase trees with selected type we'll look at all of those in a minute but right now notice how if i click and drag nothing is happening in my scene and so the reason nothing is happening in my scene is because nothing is defined yet so what we need to do is we need to come in here and we need to define some trees that we can paint on our terrain so to do that we want to click the button for edit trees we want to click on the button for add tree so the first thing we need to do is assign a tree prefab to our brush this is basically us telling it okay this is the tree that we want to paint so to do that you can click on this little button right here and so you should get a list of all the prefabs that are in your scene i'm going to go ahead and use the broadleaf mobile i know this is showing up as pink in the preview but it's not actually broken um i just had to upgrade this to the universal pipeline materials so i'm just gonna double click on that and that is going to add the tree pro to our list so now we're going to click on the button for add so now notice how i've got a little box in here showing the tree that's placed in here and so now that we have that set if i was to click and drag notice that this is going to place trees on my surface just like this i'm going to go ahead and zoom in on these real quick notice how they have the lods working which is really cool meaning if you back up notice how it's showing less detail than if you zoom in that's something that's kind of built into the speed trees trees but this gave me way too many trees all right so let's undo this we're going to do a control z we're going to jump back into our paint trees option and so notice how there's a number of different options down here that we can use in order to set things like how wide the brush is it's placing the trees so if i was to drag this to the right notice how this brush gets bigger right it's going to place more trees in here if i drag it to the left then the brush is going to get smaller so notice how that's very small right here if we do that so in addition you can also set the density of trees that's created so if i drag this way to the left and then click and drag notice how this is placing these in here a lot more slowly and probably clicking and dragging is not what you want to do probably you just want a single click and so let's say a single click right here with the density low that's going to look like this if i turn the density up and then single click over here notice how i get a lot more trees really quickly inside my scene so if i click in here notice i have way more trees on the right than i have on the left and so in addition to this there's also tools in here that'll randomize your tree height and width and so notice right now the box in here for random is checked and so what that means is that means this is going to randomly size our trees but notice how if i was to click and drag this to the left and this to the right what that's doing is that saying okay you can randomize anywhere within this range and so now if i was to click and look at this notice how we get some trees that are really tall and i'm going to undo that and bring my density down a little bit so we can look at this a little more but notice how some trees are really tall and some trees are really short so these trees over here really tall these are really short you do need to be careful though because notice how within this range i'm getting this distortion in my trees right these trees are currently being distorted because i have my randomization set so high so probably what we want to do is keep it real close to the middle but maybe something like this where we get a little bit of randomization but not a lot so now notice how the trees aren't the exact same height but they're a little bit closer and you're not seeing the distortion in the way that we were before so in addition the random tree rotation does exactly what it sounds like um it's going to set your trees to randomly rotate in here so that they're not all facing the exact same direction and so let's go ahead and let's erase these out so i'm just going to hold the shift key and click and drag in order to erase these notice how that's erasing out everything that's in here because we've only placed one kind of tree and let's say that we wanted to add more than one kind of tree so let's just come in here click on the edit trees button click on add tree so now we can add a second tree so we were using the broadleaf mobile let's use the let's use the conifer desktop so we're just going to click on this and we're going to click on the button for or we're just going to double click on this we're going to click on add now we have two kinds of trees in here and so now if i was to click in here and add some conifer trees like this you can see i can add either kind of trees to the scene so now i've got the different kind of trees intermixed in my scene like this and so let's say that i want to come in here and just erase out the conifer trees and not the other trees well what you can do is you can click on this tree type to select it and then hold the control and click in order to remove just the tree types of the tree that's selected so notice how i can remove all the conifer trees in here without removing the broad leaf trees and now i want to pay attention to the option here for mass place trees so what that's going to do is that's going to create an overall covering trees over my entire landscape so if i click on the button for place trees what that's going to do is that's going to open up this script that allows us to set the number of trees that we want to place and so you can set the number of trees in here by clicking in and setting a value so let's say i wanted to add let's say 3000 trees i can select this and then click on the button for place and that's going to add 3000 trees automatically to our landscape just like this so this can be an easy way to quickly come in here and add these trees and notice how it's adding random trees of both types that we have in here so this is basically going to use all of the different types that we have in here in order to mass place the trees and so let's say we wanted to get rid of some of these trees so all we would have to do in this case notice how by the way it didn't place these on the steeper part of this hill so it kind of takes into account the steepness of your terrain when it places these but if we did want to get rid of some of these all we would have to do is just come back in here and just use the paint function like we had before in order to paint these out so just because they replaced with the mass place tool doesn't mean you'd get rid of them any other way and so one other quick thing i want to note about that is let's say i was to bring in a controller so i'm going to bring in one of the controllers from the character movement fundamentals asset but really any controller that's set up with a collider should work this way but if i was to bring that controller in and then click the play button and then walk around in my terrain notice how you'll actually collide with these trees so if i run into these trees right here notice how it stops me so um these trees are acting as actual geometry in here that you're going to collide with once they've been placed all right so that's how many in this video leave a comment below let me know if you have any questions i just love having that conversation with you guys if you like this video please remember to click that like button down below if you're new around here remember to click that subscribe button for new unity content every week as always thank you so much for taking the time to watch this i really appreciate it i will catch you in the next video thanks guys
Info
Channel: The RealTime Essentials
Views: 217
Rating: undefined out of 5
Keywords: unity, unity software, unity 3d, unity 2020, unity 2021, unity terrain, unity trees, unity paint trees, unity place trees, place trees unity, paint trees unity, unity terrain trees
Id: 9SXxAc3mlDY
Channel Id: undefined
Length: 8min 46sec (526 seconds)
Published: Fri Nov 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.