 Howdy guys, IndiePixel here with another quick tip inside of Houdini 16.5. All right, so this time I am going to walk through a really cool little trick to make boulders for your game development projects. All right, so here you can see we can generate a whole bunch of different types of boulders or just variations of a boulder. So what I wanted to do is walk through the process of how to build this particular graph right here. All right, so let's go and create a new geometry container right here. And what I'm going to do is hide all the other objects there. All right, so we can just focus on what we're going to build. So the first thing I want to do is drop down a box. Now this is going to serve as the base for my boulder that I'm going to make. Okay, so I'm actually going to set it on the grid. So I have a preset here that just sits it on the grid and I also have some values that it comes with. So you can go and make these any values that you want. It doesn't really matter. This is really just kind of that initial seed shape to get the boulder. So if you want a really tall rock, you know, you make the box really tall. All right, so the next thing I want to do is drop down a point jitter node. And this is just going to give it that random shape. So I really like, you know, using this just to kind of do a really quick pass of the overall shape for the rock. Now you can go and use the seed value here and generate different looks. So I think I'll just stick with that. I'll just put it back to the default. So a value of one. All right, so what I want to do now is make sure that my normals aren't vertex normals. I want to utilize point normals in this case because I want the normal to actually point out straight from the position of the point there. So what I'm going to do is drop down a normal node. All right. And I'm going to set this to points. And there we go. So now we have a normal pointing out from the point itself from each point. Okay, so from here, what I'm going to do is just utilize a for loop with feedback like so. And what this is going to do, this is basically going to go through each point. And I'm going to place a clip node on each point. And this clip node is going to give us those nice chiseled edges that you saw in the example over here. So I turn on my wire frame. So this is going to actually cut off those large slabs and just give it that nice rock look. Okay, so let's go back and get that going. In order to do this, I need to actually get the point number from this normal node right here. Okay, so as I roll through each point, I want to add a new clip node and orient it and position it using the information from each point. So to do this, what I need to do is generate that meta import node. And now I don't like having this long name for this node. So what I usually do is just go and call this loop data or loop data one or two or three, you know, something that you can remember. And the reason why I do that is because when I'm actually writing out the expressions, it's a lot easier and faster to just write loop data instead of the name that it comes with by default. Okay, so let's drop down a clip node here, like so already. And I'm going to wire that into the full graph there. And what I want to do for this clip node, let's hit enter right there. I want to place this handle at each position or at each point. And I want it to face the direction that the normal is facing. Okay, and the way I'm going to do this is I am going to set the iterations right here to the number of points from this normal node. So I'm going to utilize that endpoints. So endpoints and give it the string or the name of the node we want to get the information from. And so what this is going to do is it's going to give me the number of points that is coming in from my base shape there. All right, now, again, you don't have to use a box. You could use a dodecahedron or you could use a sphere. And for every point, it's going to clip this. So you could actually create some really interesting rock looks, right? I'm just using a box here because, you know, by default, it works really well. So it works really well for the current game project that I'm working on. So because it's fresh in my head, I use the box. All right. And so what I want to do now is in this clip node is I want to place the current iteration. All right, that we're in, I want to place this clip node at each point. Okay, so I'm going to drop down a point expression here. Okay, and I want to get the information from that normal node. So normal one. And then what I need to do is I need to get the point number, right? Because if you look at the debug information or the information for the point expression itself, it wants a string, that's going to be your node that you're going to get the information from. We need a float, which is the point number that we are going to work with. And then we want the attribute that we want to pull the information from. In this case, it's going to be position because we're working on the origin. And then we want the component from that position. So in this case, it's going to be x because we're currently working with the x. So in order to get the information from this loop data node, all right, we need to utilize the detail expression. All right. So if I actually open up my geometry spreadsheet here, and click on this guy, and then go to the detail information, you can see that we have this iteration detail that comes with this node, with this metadata node. So I want to get the current iteration that we are on in this loop. All right. So let's go do that. So I'm going to say detail. All right. And we're going to get that information from that detail information or detail attribute from that loop data node. And I want the iteration attribute. And it only has one component. So we just put zero for the first component. All right. So then the next argument we need for this expression is the information we want to get or the attribute. So in this case, it's position. And then the component from that position. In this case, it's x because we are working in the x component right now. So then I'm going to copy and hit tab. That'll take me over to the y component. So I'll hit one for y and then two for z, like so. All right. And then we'll take a look down here. And this guy is, there's that. There we go. Just needed to be rerun there. Alrighty. So we are getting the clip. So if we take a look here, you can see that the clip handle is now being placed at the point that we're currently on. So what I want to do now is make sure that it's oriented to the normal. So we can utilize the same expression here and just put n in for that. And that's the normal attribute. Okay. So I'm going to copy that now and hit tab to quickly go through each component of the normal direction here. And there we go. So now we're oriented to that particular point. So if we take a look for a template this year, we're now perfectly oriented. And what we can do is we can then take this and start to pull out chunks of the mesh itself like so. And so what I want to do is keep the primitives below the plane like that. All right. So let's take a look. And you can see that now for every point we are clipping out the particular information. And Houdini does a great job at maintaining the integrity of the mesh here. So all we need to do is just polyfill after each iteration here. So I'm going to do a polyfill like so. And voila, we have a rock shape. Pretty easy. And it looks like we did miss one there. And that is because what we want to do is set this to single polygon. And that will take care of that. Perfect. Okay. So awesome. I'm going to actually just save this here really quick to my desktop. I'll make this available for you guys. We'll call this boulder maker. Beautiful. All right. So now you can see if we expose this value we can actually create some pretty cool rock shapes. And we have two core parameters that we can tweak to get different rock shapes. So you can just go through the seed value. And you can also now go through and use this distance to get different rock shapes. So to take this a little bit further, all right, what I want to do is go and put down a resample node here like so. And you'll notice that we resample every edge. So I'm going to say resample by polygon edge and just increase the edge length. I don't need too many points there. All right. So I'm going to save that. And then what I'm going to do is drop down another point jitter node. And this will just add some more detail to some more natural detail. So I'm just going to pull that down. It doesn't need to be a ton right now. But you'll notice that when we do that, all the primitives for this particular rock, all the faces here, aren't fused together. So we need a fuse node. So I'm going to drop down a fuse node here before we go into that point jitter. And now everything is nicely fused together. And obviously our normals aren't great or anything like that. And that'll be taken care of here pretty soon. All right. So that's starting to give us something pretty cool. So now what I want to do is do a bevel to this, right? So if I were to, let me save this here really quick. If I were to drop down a poly bevel node, and we just bevel every edge in here. So let's set this to edges just to make sure it's not necessary. It'll usually do it pretty well by itself. I'm going to turn off the, I'm going to set it to one. So that's pretty good right there. So you notice now we have a pretty good rock shape. Now you can do a lot of things with this after the fact. The first thing I want to do is actually randomize that bevel. So I'm going to drop down an attribute randomize. There we go. All right. I'm just going to call this rand bevel. And I'm going to make sure that we only have a single float. So I'm going to say we can go and do a bevel from 0.5 to 1.5. Just as a default. Just to test that out here really quick. We can always change it because Houdini is procedural. So we're never stuck. So to utilize that, I'm going to turn on the point scale here and put in that name. And you'll notice now our bevel is random. So now we don't have this uniform bevel around all the edges. Just helps out the look of the rock even more. Let's drop down a normal node and do that. So obviously it's not going to work out too well for us. So one thing you can do, there's a lot of things you can do at this point. I mean that is the basics of creating this boulder. But I'm going to go and put this into a VDB. So VDB from polygons. And then we have a pretty interesting looking mesh. All right. So at this point you could even go and do a volume vop or you know mess around with the VDBs and subtract stuff from this. And at this point like you have a really good rock shape. And it's pretty fast too if I were to go and change the seeding value on this here. You can see that we're moving really fast. So you can generate tons of rocks really really quickly using this particular technique. All right. Which is why I wanted to show it. I thought all you guys would be really interested in this. So I'm just going to leave it at that and let's do something like 0.05 for the resolution. Like so. And then I'm going to do a convert VDB. So I'm going to convert it back to polygons. And this just helps me to even out the topology. All right. So there we go. And at this point we can go and reduce this so we can use the new poly reduce node in here. I'm not going to go into too much detail with this. I'll probably make another tutorial about all these new features here. We'll just take it down. And if we equalize the edge lengths. I don't really like that too much. But this is why I don't want to get into it too much. Because I do want to utilize curvature to maintain the edges but have the big faces. You know it's big polygons. You know because it's a rocket static in the game engine you're not really going to need all those polygons unless you really want to have that. Let's say you're doing a very high res rock or high res the low res and you want to then go and say add another point vop here. All right. We'll add some more kind of micro details to it all so we can go and add something like a noise or an anti alias noise. We'll drop in that position and let's just expose the frequency and offset there. And let's do a displacement you know the use. So I'm going to put in the point and for the position and we'll take that noise as the amount and we want the normal. So let's make sure we have our normals. Yes we do. It's a fuzzy rock. All right. So let's go and displace this. There we go. It's pretty cool. So let's do you know keep it at a 1d noise from now and then we can just go and you know change the the roughness of this right and that resolution is really being driven by that vdb. So if you want some more resolutions come up here and do 0.0. Actually that'll make a lot of resolution. I don't want to freeze my computer up while I'm recording this. So there you go. So now we have a rock. All right. So you can use this as the high res and then just so we'll do something like that. Right. So then put down a null over here. We'll say high res out and then we'll reduce this guy if I can select it. There we go. Down to something like five percent. See what that gives us. Or let's just do one percent. Probably do the trick quite nicely. Yeah. That's probably even too much. How many polygons do we have here? That's definitely still too much. So 0.5. 0.1. There we go. Now we have a nice low res. Some of these. Yeah that's a weird one right there. That's why you want to go through some of these properties and just maybe equalize the edges just a little bit. I'll probably take care of some of those artifacts in there. Or those slivers. Yeah there you go. So it's a balance right. So you sacrifice the edge detail. So maybe if we did 0.05 here with equalized polygons. There we go. That's not too bad overall. All right. So that is basically what I wanted to show for this particular video. Hopefully you guys liked that and hopefully it helps you with your rock development adventures. All right. I'll see you guys in the next video. Thanks so much.