#Houdini Scattered Primitives to #UnrealEngine4 Foliage

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to show you how to use Houdini scattered primitives to create foliage and Unreal Engine 4 so what we're gonna do is first we're gonna just do a basic scatter of some objects and turn them into foliage and to do that we're going to first scatter objects on to ue4 landscape assuming that's like I mean you use full a general landscape so it's pretty much the only place that makes sense for it then we're going to scatter packed primitives which are the Houdini equivalent of a static or instanced mesh and Unreal Engine and then finally we're going to bake those two foliage as an extra I'm going to do some things that are this is just a generic scatter node thing which lets you control the size and the normal of it so that you can give each of the place two primitives a little bit more variation so the first thing we're gonna do is scatter to an unreal engine for landscape and we're gonna start in Houdini do a basic scatter using a grid scatter node copy two points node then we're going to turn that into an Houdini digital asset and we're going to expose two parameters on the Houdini digital asset force total count and global seed and then finally we're going to connect the EM the subnets number one input to the scatter node which will let us feed in the landscape and on once we move over to Unreal Engine then we're going to move over to Unreal Engine and use the landscape landscape as the input so let's get started in Houdini so here's a blank project I'm going to put down a geometry node die then I'm going to create a grid I'm going to put a scatter node down let me increase the size of these points so you can see them a little bit better and then I'm going to put down a copy two points note this takes two parameters one is the target points to copy to which is going to be our scatter node and the other one is the geometry on a copy and we'll start with a cube and we'll just make the cube a little bit smaller so you can see them individually maybe I'll turn down the number of objects we're scattering so you can see them all alright I'm also going to make the cube bigger in the y-direction just so it's a little bit more obvious what's happening okay then I'm going to turn that entire thing into a digital asset I'm going to save it in my projects HDA folder just so I can find it later when I'm working with unreal I'm gonna call it my scatter [Music] and the parameters I said I was going to expose were on the scatter object one was forced total count and one was global seed so on force total count I'm also going to change the max range to be just a thousand for now so that I don't accidentally make it real high which can make the end Houdini engine take a long time to generate everything so you can still type in iron umber that just the slider that will be an Unreal Engine 4 will be low ok so let's accept that they've turned green indicating that they're you know connected the inputs of digital asset now then I'm going to go to assets save asset subnet one yeah let me just check on oh the other thing we were gonna do is connect subnet Oh first let's bring it in yeah well we'll go to Unreal Engine first just so you can see what it's like so far all right so here's a empty project in unreal going to import that HDA that I made so here it is under the HDA folder called my scatter drag it in and you can see it's scattered the objects I asked for and you can see there well let me see where's the location of this let me put it at Z equals 0 then let me get rid of this floor also and just like in Houdini I can change here's the two parameters I exposed forced total count and global seed I can increase the force total count I'll get more geometry I can change the global seed to get a different variation okay that's great but if I go down to my baking options let's see if I can find them baking you can see that yeah I can bake it to actor's blueprint but I can't bake to foliage and the reason why not is because I haven't created instanced output yet so each one of these things are being or is a separate mesh in the scene it's not like one mesh that's drawn n times it's and each mesh is I should say it's not using instant static mesh to draw so we're gonna change our Houdini digital asset to support that so switching back actually let me go back to my outline see if we're on on target open okay have to connect subnet one to scatter and that's so we can use it my landscape and let me show you what I mean in Unreal Engine first so if I put down a new landscape here [Music] and it doesn't really matter what it is so oops yes I'll just create that I made it accidentally made the overall resolution too big so it's taking a little while oh yeah I made that way too big let's just delete that and try again for this test we can turn out--we down it's not that important [Music] okay and then I'll just sculpt a little bit of hills [Music] all right that should be fine so now I've I've managed to scatter all of these on to a grid all these boxes but what I want to do is scatter them on the landscape and so what we have to do is go back to the Houdini digital asset and do that so we go into the subnet and what we need here is access to input one so we'll go over to inputs and say it's under basic and we say minimum inputs one maximum inputs one let me say accept and now we get an input now instead of the grid we'll feed whatever's in this input into the scatter node now it doesn't know what we're giving it yet so it's gonna get a little bit pissed off here also while we're in here I'm gonna go to the no I'll do that next sorry you want to get out of myself okay so one thing you can do too is you can put a switch in here so that you can have either a grid or a mesh or a you know height field like I'm using like I'm planning to use I'm just going to do the simple way right now so I've changed that we need to save the asset go back to unreal engine rebuild all instances of that asset and now when we look here on my scatter and world outliner you'll see I have a Houdini input now and I can pick what I want to feed it and so I'm going to drop this down and select landscape input and then it has a picker so I can pick the landscape I want and that's it now all my objects are scattered around the the landscape and let me create more of them so that I actually see them we'll supply around the landscape so you can see there's a couple [Music] [Music] and you're probably wondering why is everything floating above the landscape and that's because I exported the landscape as a height field and I need to use mesh and when you do that it'll work with the copy of points node so there we go now one thing that's kind of interesting is that it looked like it laid down all of the objects that I was scattering and not sure why so we'll figure that out in a second let me go over to my notes again see if were so we've done all this stuff we've selected the landscaped as input so now let's go to the next slide which is scatter packed primitives and I think doing this will probably thick fix the problem with the mesh is being laid down so the first thing we're gonna do is go into Houdini and turn on the packed in instance and the copy two points node and we'll just take a look at the node info so you can see the difference between having that on and off and then in ue4 we'll select different mesh meshes to instance okay so back to Houdini in the scatter node sorry copy two points node here's the pact and instance checkbox that's all we got to do save the asset again back to Unreal Engine rebuild all instances instances of the asset again and now you'll see a couple of things so first we get it Houdini instanced input and this allows us to actually change it to another mesh so like if I look for sphere I can turn the ball into spears or any other mesh cones in there yeah and you can see they're all laying down so we'll get that fixed in a second they are scattered on top but they're just pointed to the side instead of straight up like you'd expect but since I do have packed instances selected now you will see that I can bake them to foliage so just to show you that I'll hit bakes it to foliage successfully baked 3000 instances of cowan to foliage and I can actually get rid of this my scatter node now with wine the same I should be able to it's not letting me I'll just hide the visuals on it for now and then if I go over to foliage you can see yep I got three thousand instances here of this cone and it so created this foliage type and place them and I can now use all the foliage tools that unreal has like I can select an individual one move it around of course if I wouldn't use my tool again it wouldn't know any of this but yeah so they're all the same size though well I'll show you how to create a little bit more variation with that in a second so I'm gonna delete these bring my tool back okay and then go back to my slides oh one thing we forgot to do is look at node info so I'll go back and show you that so looking at node info on the copy two points node so I'm gonna switch to the grid just so I can get rid of this error which isn't really an error when you're using it isn't a digital asset but and you can see right now the number of packed Gio's I'm using is 118 that's because my scatter node has 118 selected here if I slide this around you'll see this changes so this is 512 now now there's 512 packed Gio's and if on the other hand I tell copy 2 points sorry scatter no no copy points yes to not use packed in instance then instead of a bunch of packed Gio's you'll see a whole bunch of polygons and you can see how much more geometry is used when you're doing non instanced or non packed versus instanced or packed so and you if you want use foliage you have to have packed so we're turning that on so this is what you should say you should see packed Gio's all right I showed you how to select a meshed instance we baked the foliage I showed you the buttons only enabled when the HDA has instanced output so the next thing we're going to do is use some attributes to control the scatter and this will let us put variation in the scale of the object and also variation in the normal so let's get to it I just got a cheat and look at my other project that I have that shows me what the attributes are called so I mean I know they're called but actually how I set them up so we're gonna be using these nodes called attribute randomize and the first one we're gonna do is P scale so by default user CD which is color but we're gonna use P scale and what P scale does I'll just show you the documentation on a real fast under geometry attributes you can see all of these and P scale right here is a uniform scaling factor so it's just a single float and it scales it on all three axes the same amount so that way we don't get distortion we just get different sized objects right so this is a randomizer so we're gonna say go ahead and use uniform distribution we're only in this case it's a single float so our dimensions should be 1 and the smallest we ever wanted to be as say 0.3 and the biggest we ever wanted to be is 4 oh sorry 1 so that should be good for that and then for the next one we're going to randomize the direction it's pointing and so this is the N attribute or the normal attribute we'll also use a continuous distribution in this case it is three dimensions because a normal has three axis it's a vector it's a three-dimensional vector and for the min value all zeros I guess it's a normal actually always has a length of one so it's kind of weird for it to all be zeros but this worked in my other code so I'm gonna keep it we're not quite sure exactly why I did that and then I'm not going to let it change in one of the directions and so that's the y value is always going to be zero here so it's gonna change like which way it's pointing around the Y value so it's gonna let it spin randomly but not kind of lay down okay so then those attributes need to be added before the scatter node so I'm going to throw them in here and already you can see when I add the piece scale attribute I've gotten variation and the size of the objects and now when I add in the normal I'm getting variation and rotation as well okay so I'm going to go back to my sub Network input also just as a thing that you probably want to do you should you should add an output node to your hoody new digital assets that way it doesn't matter what you have set up as the display or render node the output will always be used and it's because sometimes when you're debugging you're in here clicking around and you might leave it on box for instance and that's all that's there you go back into unreal and all you see is the box and that's because you have this thing set to render mode but if you have your output node on there it the Houdini digital asset always uses this for rendering output all right so let's save the Houdini digital asset again jump back over to unreal rebuild all instances now they're pointing up because I set the normal the direction I wanted it's probably because I didn't give them a normal so they're just laying down for some reason okay and if I wanted to I could lift them all up you could see they're like kind of under the terrain a little bit under the landscape and that's you know like you basically have to you could adjust that in Houdini or on the Unreal Engine side but it's kind of not important for what I'm showing you now because I'm just trying to get you to scatter stuff and I'm gonna go ahead and change this back to the defaults box thing that I had created so we'll just fly around and look at some of them and observe that they're all rotated slightly differently there's different sizes and I'm also going to increase this to 6,000 to double the density here so I'll just take a moment while it's computing that now let's put it under my terrain possibly because I don't have the zero doubt actually that probably doesn't have anything to do with it I'm not sure what I just did need to debug this [Music] so I'm just putting everything back at zero to see what's going on and then I want to change something on here just to get it to regenerate now let's go take a look at it not seeing a huge variation in sizes but I guess I went between 0.3 and 1 I probably should have gone a little bit more severe to make it more obvious I'll do that real quick [Music] this would be a good thing to expose actually so why don't we do that so I'm going to go back to type properties parameters and I'm going to expose my min value and my Max value for my scales so I'll also call that scale man and scale Max forgot to say that you need to remember to do that so save the asset [Music] rebuild all instances okay so now I have these skill values I really only needed the first one I brought them in as a four dimensional vector but it's only the first value on each one so I'm gonna change scale max to four so a lot bigger and then so now I can see a lot of variation so I'll just fly around the scene so we can take a look [Music] so now once again I'll just select this and bake it to foliage then I'll hide the my scatter actor the foliage is still there so you can see this foliage actor and from here I can also change you know what's my foliage actor and that thing will be instance and it'll work just like foliage and that's it
Info
Channel: Doug Richardson
Views: 8,331
Rating: undefined out of 5
Keywords: houdini, ue4, unrealengine4, gamedev, leveldesign, environmentart
Id: 0PjZ9awgdFY
Channel Id: undefined
Length: 25min 58sec (1558 seconds)
Published: Sun Aug 11 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.