Height Field Scatter H17.5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so welcome to this tutorial which is going to look at hide field scattering in Houdini this is a subject that's been covered in a couple of other tutorials but I must admit that I remained a little confused about how it works after seeing those so this is just a description of of how I came to understand - scattering so I've got a very simple scene here I basically got some sets of geometry three types of house three types tree and three types of rock and I've got a very basic height field start of a very basic height field here which we're going to scatter at those houses and trees on - so you can see the height field is not particularly realistic it's just this sort of stepped shape the masking that I've already put in here is actually just a mask by feature which is detecting the flat areas of the terrain and that's where we going to scatter our houses which will tend to be on the flat areas now in fact the way scattering works means that it's advantageous to shrink these masks a little bit because if you have houses scattered on the edge here then they can go into the the sloping area which we don't want so we can have a height field mask shrink node like so and by default it's going to shrink it too much so let's go down to two and maybe put it at about four and you can see that's now shrinking away from the sloping edges here but it's not shrinking from the borders of the of the height field and that's because we've got the override border set to streak and what we want to set it constant and a border value of zero and that will give us what we want so let's lay down a height field scatter and have a look at the inputs to start with so those three inputs there's the terrain at the first input then there's a mask or scatter points and in this case it's going to be the mask that's coming in here and then the third input again to be the objects that were going to scatter and to start with I'm gonna scatter from these houses that I've got set up here and let's just talk a little bit about these houses so let's look at this one so I've got a house it's modeled so that it sits on the XZ plane and that's important so that it doesn't sink into the terrain and then I were creating two attributes on this house one of which is called class and the other is called weight so the class is what's going to be used by the scatter to distinguish between the different types of house so in this case the class here has a value of zero the class on the next version of the house has a value of 1 and the final version of the house has a value of 2 and then the next attribute is weight and weight is an attribute which tells the scattering algorithm how many of each type of house or whatever object it is that you know scattering how many of each type to scatter so in this case I've got the weight on all of them set to the same so point three three three point three three three three and point three three three so that's gonna be a third each it's gonna it's going to be scattered evenly but if you wanted more of house one you could increase this value and then finally I've added some colors here those are actually not going to show up in the render they're just allow me to see quickly which variants of the house are being placed so let's connect this up and have a look at what I had power field scatter is going to do by default and by default we're not getting very much that's interesting so let's go through the parameters here and have a look of what they what they do I'll just maybe enlarge this a little bit so the first parameter up here is a parameter which is going to define a name for the things that are being scattered because what will happen is that the scatter is either going to scatter points and later on you're gonna instance geometry to those points or you're going to scatter packed primitives and then render the packed primitives later on and in either case what you want to have is a name associated with those points so I'm going to call this houses and this scatter method we're going to use a couple of different scatter methods here but I'm going to use the total point count using mask layer and that is going to give me these parameters here this is the number of instances that are gonna be and this tells you how big the instances are going to be and in my case I'm gonna have a really small point count and leave it at that so I've got now five instances of a house being put onto my masked area which is good because each of these houses is going to be at the center of a sort of village and I can play about with the distribution here by changing the global seed so we can as usually as we change the global seed the sizes and the types of house are changing now the way that it knows which pieces are different houses is given by this defined pieces parameter here at the moment it's set to from connectivity so just having a look at everything that's coming here it will merge together it's finding the pieces that are separate 3d objects and it's using them as the separate houses in fact we've set up this class attribute so we're going to change this to from attribute and set it to class and now we can see hopefully when we go into the geometry spreadsheet well that we first of all it'll click here to show you what we have perhaps you can't try sharing the node information what we can see is that we've got seven points and five packed Gio's so in fact the the seven points two of those are to do with the height field they're that mask and the height the five packages are these houses that we can see displayed here and if we have a look at our geometry spreadsheet and have a look at the points we can see that we've got a number of parameters that are set out here including a tag parameter and the tag parameter is the thing that we set up here when we set this name to houses and then we've got the UV coordinates of the place where it scattered and then we've got this thing called variant and the variant is the class number of the instance that we've got being placed in that particular location and later on when I come to talk about instancing which you may need to use for renderers other than mantra for example for octane if you want an efficient render then this variant parameter comes in very useful so if we have a look at our houses we can see that they're all rather straight and they're not they're not rotated at all and the reason for that is that we haven't set a variation here so there's a set of controls here which allow you to randomize the up direction and to randomize the yaw in other words how much rotation there will be so I'm going to give that a value of 180 which is going to allow that the buildings to be at almost any angle mrs. is randomized as you can see now the control here instants on new points determines what is happening at the moment with this selected what we're getting as I showed you earlier is pax geometry which is representing houses if we turn this off we're just going to get points and the disadvantage of that in the current implementation of right-field scatter and I'm not sure why this is the case is you lose the variant attribute you no longer have a variant attribute and that means you can't instance later on and have it choose which variant organ instance so now I want to add some more houses clustering around let me just swap this back to in sitting on your points some more houses clustering around each of these houses and for this I need another height field scatter and in this case I'm gonna add this again so this points into the second input and the third input I'm gonna have the houses again alright and let's just adjust how this is going to work so one of the and we'll call this houses two let's say for the surrounding houses you can call it anything you like and the method of scattering this time is per point count using source points what this is going to do is take a set of incoming points that's the houses that we already scattered and then scatter some more houses in this case around them so let me choose that and the source point tag is houses and the range I think four to six maybe that's okay and then let me change this we need to get these so that they're not pushed up onto the slopes here so this range parameter is telling you how many new houses are going to be instance around at the original house the positioning method the one I actually want is origin so the incoming points are going to be the sort of center of each of these clusters of houses and then the radius and I vary between 0 and 6 and we need to increase this radius to about 2 I happen to know so that we get the buildings so the buildings don't overlap and that of course will depend a bit on the size of your your geometry so the relax points section of the of the parameters here you can control this to work out how efficient it is how how far it is at ensuring your points don't overlap I in fact have not found that you need to change that much and again we're going to randomize the the rotation so now we've got a set of variants in each of our villages there and that looks that looks pretty good that one is just on the side of the slope but I think it's ok so yeah I think we can go with this so the next thing I want to do is to scatter some trees and I want the trees to be in the places where the houses are not and in fact I've noticed here we've got we've got some unfortunate things here with the houses hanging over the edge I'm not going to bother to fix that now but by playing about with the radius parameters and the seed you can usually make sure that this doesn't hang out over the edge but for the moment we'll ignore it the way that you can scatter trees in the places where the houses are not is by creating a mask which excludes the areas where the houses are and we start by creating a mask which actually surrounds the houses because there is a mode called mask by object and that's what we're going to use so the first thing we need to do is just make sure that we've just got the houses and nothing else so I'm gonna use a blast node and I know that the points and the patios which have the houses have one of two tag attribute remember we had tag attributes here on the points and the tag attributes are either houses - or houses so if I set up a blast and I use the syntax for attribute so I go hat tag equals houses and at tag equals houses - and I delete non-selected now what I should find are we I make sure that I'm deleting points then we should find that we're just getting the houses left and then this node here takes a terrain so we're going to go back to get a terrain here and the second input are the things that are we gonna masks if I now select this we're replacing the mask and we're projecting at me you could just about see that underneath there there is a mask but it's it's very small so we're going to need to expand it and unfortunately there is a mask expand node like so and that will spread the mask out in this case it's far too large let's try something like four or even three or even two maybe two there are two problems with the mask at the moment the one is that it's masking the areas around the houses where if we want to mask the areas which are not around the houses and the second is it's a bit square on the outside you can see it has this square shape so let's deal with that shape issue first and we can use a height field distort by noise and we can distort the mask like so and we need to take the amplitude down and as you can see this is distorting the shape of the mask let me just change the element size maybe make it her yeah that looks pretty good I think that'll do okay yeah so that's giving it a bit more of an interesting shape and that making sure the trees are not going to be too regular around the around the villages and the next thing I need to do is is do height field remap and the height field remap again we need to make sure we're working on the mask layer we've got an input range zero to one and an output range and simply by reversing the output range I can reverse the mask and so we get an area here which is where we want to put the trees but before I scatter the trees I actually want to adjust this mask and what I want to do is to create some roads which are connecting the villages where we won't have trees so let's do that and we can start working you have a look this way so we can use a hope-filled paint node and again we're going to put it on the mask and we can have a foreground value of zero and a background value of one see how big a brush is far too big radius 5 let's say yeah that's a bit more like it and now what should happen is if I paint on here we should get a road and then I can paint like labs and get another Road and I pay my at and we get another road and I can add strokes here to give it a bit more width for example so that's going to be controlling where the trees are scattered and it helps me to make sure that I have something that looks reasonably realistic so I'm now ready to put down another ID field scatter like so let's enlarge this so in this case we want add trees to be the inputs the trees are over here by again to be the third input we want a painted mask to be the second input and we want to add rain but we were using earlier on as a third input and what we're going to do is use a different of course trees by the way I'm going to use a different method before we used first of all total point count using mask layer that gave us just five initial houses we then used per point count using source points to surround those initial houses with further houses this time we're going to use buy coverage and mask layer and I seem to remember that the defaults work reasonably well let's sowhat's end here there's some kind of error nope there's never right C&C right actually you can you can see that worked out pretty well I've got a couple of problems here trees here are as you can see not realistic they're sort of pointing along a normal direction rather than straight up and that's very easy to fix because there's a parameter here which says match direction with slope and if we so match normals with terrain and if we turn that off the trees all start to point upwards which is probably what you want in this case we want to randomize your again rotation and I think we can give a little bit maybe ten percent no that's too much three percent of varying of the normal direction so that we get a little tiny bit of variation like fat so we can see that stunning look pretty realistic now actually pretty good we're not getting any overlap between I seem to have failed to join the final village up with a with a path never mind you can see the concept so the let me just check here that we've got these set up correctly so this here is what tells you how far apart these things are going to be scattered this tells you the variation in size so if I were to do a big variation in size you can see some of them will be enormous but we don't want that so the defaults here seems to me working pretty well this section as I said prevents the trees from overlapping each other this section controls the normal direction and so on and allows you to randomize the the the rotation and again actually we want to have this from attribute we want to use the class attribute and that's because we got the class attribute set up here seems to be giving me a strange result there let me just investigate why it's giving me one kind of tree okay well the answer as to why that wasn't working was because I set up my class attribute wrong so there were two things wrong with it one of which was that it was float instead of an integer and it wasn't the primitive attribute it was a point attribute so I fixed both of those things so that now this is producing a correct distribution so the final component that I'm going to add to the scene are some rocks so let me add another height field scatter bring in a terrain bring in the mask and then second we seem to be getting the wrong mask there needs to come from the paint mode let's put that back there that's interesting that that is that's the correct mask well at the moment is despite displaying the wrong mask for some reason we're going to connect the geometry to be scattered to a set of rocks that I've prepared earlier like so and in this case I don't have a class attribute I'm just using the weight and we're going to scatter using the mask and let's call this rocks and we're going to use by coverage using mask layer or let's let's do by density using mask layer and then we need to up the density like so that's pretty good okay and we can see we've got different types of rock being initiated instantiated there and I'm going to change this so that there are a random rotation like so and that seems to work pretty well they're not overlapping with the trees and they're not overlapping with the houses so they're not labeled everything with the houses because we've got a mask there and they're not overlapping with the trees because we've got this relaxation option here avoid point tag set the star so that's avoiding the trees we could just type in trees here and we would see that doesn't change things very much it's still avoiding the houses because of the mask so that's our final set of not avoiding the trees terribly well there if I had missed named that the scatter of trees was called trees so that should work maybe I need to change the fall-off to zero yeah that's helped okay the reason was that I had a fall-off which meant that as the the scattering was not taking account of the full size of the tree and that seems to be all right yep good all right well the final thing we can do is to delete the mask layer and I can do that using a layer clear like so and then just clear the mask so total value of zero like so the thing I should say by the way is some of this geometry we set a class attribute to distinguish the different pieces of geometry some of the geometry in particular the rocks what we've done is used this from connectivity which allows the node to work out automatically which bits of geometry are separate from which it even when you use this from geometry you get a variant number so you can see here we've got rocks tag and we get a very number even though this this node does not have a class attribute defined so that's basically how the height field scatter works I wanted to add a little bit extra to talk about how this can be used in a renderer that is not mantra a renderer that does not accept impact primitives how can you render it efficiently well in octane you can render you you can render pact primitives but it's not very efficient it simply unpacks the primitives and then renders them or at least that's the current version the way that it does instancing is to use the instance name so I wanted just to illustrate very quickly how you can use instancing to take what you've generated here and use it for a renderer like octane so you'll have noticed that the scene has changed here and that's because I've loaded up seeing that I prepared earlier and already has the instancing set up so let me have a look at this let's enlarge this so the first thing you would need to do to use octane to render this efficiently you can't you can just render this but it the the back Gio's on this but it wouldn't be very efficient for a scene of this size it probably wouldn't make much of a difference you could you could use this amount of geometry it wouldn't be a problem but for this if you had a very very big scene with many many trees and so on then you would want to use instancing so all I've done here is is for each type of geometry I'm bringing in a file mode and just loading it into the scene and then I've got instance nodes for each of the different types tree instance rock instance house instance and so on so let's dive inside one of these and see how it works so in this case I'm bringing in the results of that scattering that we did I'm blasting away everything that isn't a house and remember the houses have a tag of our house well in this scene I used house and house two in the video I just showed it was houses and houses too but it's the same so this is just going to give us the points with houses on and if we middle click here we can see that we've got 24 packs Geo's so we've got 24 houses and then we need to deal with the variant so there are three variant and I'm going to delete everything that doesn't have a variant of zero and then I need to do something to cope with the fact that what we're using here are the packed geometry points and this is unfortunate but the packed geometry points are positioned at the center of the at the centroid of the thing that is packed whereas our houses were designed to rest on the ground plane so if I didn't have this adjustment here what we would find is our houses will be floating up above the ground so we need to set the Y position of our instancing point from an attribute which is helpfully stored on those points which is called height and that simply records the height of the height field at the place where the instance is being instanced so all this does is it sets our y coordinate for these points to the height and then this add node is simply deleting the geometry in keeping the points remember this is packed Gio's we're dealing with in fact if you feed the packed Gio's in two octane then it appears to instance on every point of a patch here so this just cleans it up so that we just have points and the points have various things that determine how the how the instance will be rendered for example it sort of orient attribute that's the thing that's going to give it the rotation it's got a piece scale which is going to bury the size and it's got a UV attribute you could use that perhaps to change the color of the of the instances I haven't seen how that would work in hock keng so essentially we're doing exactly the same thing for the houses for the trees and for the rocks and of course also we need to convert a height field into polygons so that it can render in octane so let me come out of this and let's just have a look through our camera and then let's render this in in octane if we can get there so I've already set up I should say also some very basic materials added them to the houses render target something that's shading the ground and so on and so it should be the case that if I click I PR this is going to render so let me do that and it's going to take a moment because it hasn't rendered this scene before so perhaps I'll just pause the video while this is happening I know there it is ok and we can see that we're getting pretty much what we expect a nice high-quality render from octane this is a very cartoony type of scene that I hope you can see how you could use it to create sophisticated landscapes and render them in octane thanks very much I hope it's been useful
Info
Channel: peter quint
Views: 2,463
Rating: undefined out of 5
Keywords: houdini, tutorial
Id: 5La_Lq3Gpk0
Channel Id: undefined
Length: 32min 57sec (1977 seconds)
Published: Sun Aug 04 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.