 Howdy guys, IndiePixel here. In this video, we're gonna walk through how to set up an HDA so that we can take advantage of using vellum inside of our HDAs, inside of Unity and inside of Unreal. So I'm just gonna cover the Unity side of things, but we're gonna go look at how to make it so we can assign collisions to our cloth objects and how to set up pinpoints for our object as well as go over some reduction stuff and just the whole workflow in general. So let's take a look at how to get all this stuff set up inside of Houdini and Unity. All right, so the first thing we're gonna do is we are gonna create a new geometry note. I'm just gonna give this a name of IP vellum cloth, something like that, and we're gonna right click on it and say create digital assets and I'm gonna go and set up my namespace. So you just put the tokens like so and then at the end you just do the version number same way, then you can also give it a different label if you want. Done here, I tend to go and capitalize these things. I go and then we wanna go and save it into our project. So in this case, it's my hit directory and so I'm gonna name this folder HDA and I'm just gonna save it right there for now, say accept. Now we're gonna store all spare parameters. Then go to the version number and put in 1.0 and in the parameters, I just wanna go and hide everything because we wanna go and set up our own custom UI. So I'm just gonna set those guys to invisible, hit accept. And just make sure I save the node type and we now have our HDA. So now let's put in the meat of the actual HDA. I'm gonna double click it to dive inside and for this demonstration, I'm gonna just set up a simple grid. You could actually feed in any sort of mesh that you want, but in this case, I'm just gonna make a simple grid here and we'll default it to 10 by 10. So let's actually add that to our type properties. So just right click on the HDA right here and just go to type properties and we can just go then and do an alt, middle mouse click on the label here for the size to promote it to our HDA up there. There we go. Now your defaults, you might wanna pay attention to, you might wanna set that to just one for the minimum size and maybe 50 for the max. This is a simulation, so you could get quite a bit of geometry created from this particular technique system. So you wanna keep all this stuff in mind. So the defaults are 10 and 10, that's good. Cool, so I'm just gonna say apply and accept. With our grid done, we need to apply some UVs first. So it's a good idea to do that. So you know you have the UVs now. If you wanna just verify that your projection plane because we are using the orthographic setup here. If you wanna verify that in the scene view, you just wanna go and select the node and then hit enter in the scene view over here and you can see that our plane is perfectly oriented correctly and we can do a space bar five on the keyboard and to go into the UV view, just to also verify that we actually have UVs, then do a space bar one just to go back or just one if you're already out of, or in camera mode. All right, so now we got UVs, I'm gonna do a remesh. So let's drop down that remesh node and really we're just doing this because the vellum solver likes to work these triangles. You just get more realistic cloth look out of it. So the one thing that's really important here is the size, this allows you to change the resolution of the simulation. So we should probably promote that. So I'm just gonna go to my type properties again and I'm just gonna do another alt middle mouse click there to promote it to my type properties up here so I can tweak this stuff inside of Unity. Also inside of Unreal for using the Unreal Engine as well. And so I'm just gonna leave the labels and all this stuff set up by default for now. You can tweak it all later. I really just wanna cover the technique here. All right, so with that all set up, we now have our grid. So I'm just gonna drop down a vellum configure cloth. I'm just gonna wire that in like so and all the defaults will be fine for now as well. And then we're gonna go and get the solver. So we just want the vellum solver. I'm just gonna mouse over the guy to auto hook up those lines there. There we go. So now we have the vellum solver in here. So I'm just gonna hit play just to verify that it's moving. Yep, there you go. And it's actually got some pins there. That's pretty weird. All right, so let's go now and set this up for the Houdini Engine. So I need to actually drop down a timeshift node here to control the solver because inside of the Houdini Engine, we don't have a timeline, right? There's no timeline. And so this timeshift node allows you to push time forward and backwards, which then triggers the vellum solver to run inside of the Houdini Engine. So all we need to do is just expose this frame value to our type properties. So I'm just gonna open up type properties here and just do an alt, middle mouse click. And now we have our frame. One thing you should take note of is just lock this at one. Because if you get zero frames, it just removes all the geometry from the HDA. All right, hit apply and accept. All right, you can also leave that open if you don't wanna have to constantly be doing that. And then finally, we're gonna drop down a vellum post. So let's do a vellum post process. This just smooths things out for you. We'll set the subdivision to loop. You can also put up the blur a little bit as well. Or just promote these parameters to your HDA. All right, then I'm just gonna drop down output note here. And there we go. So now we have a really basic vellum set up for our HDA. So let's go and test this out now. Inside of Unity, first thing, always remember, right click on your HDA and save it. So let's go and test this out in Unity now. Okay, so what I did is I opened up the folder location of where my HDA is. And I'm just gonna drag and drop it into Unity over here into my HDA folder wherever you wanna save these guys. And I'm just gonna pull this guy off screen. And now I just wanna drag and drop this into the level. You can put it into the hierarchy, you can put it in the scene view, it doesn't really matter. All right, so you get your grid and we don't really have a lot of parameters yet, but you can see over here in the inspector, if I can grab this guy, there we go. All right, so what we can do is go and change the size. So we can do something like four by four and we can change the overall target size. So to see that, we just go to shaded wireframe there. And we go to something like 0.5, you can see we've got really big triangles. If we do like 0.05, we get really tiny triangles. So you get more resolution out of it, which gives you a better solve. So I'm gonna leave it at 0.2 just to start here. And if I were to increase the frames now to something like 20 and let the Houdini engine run, you can see that our cloth piece is all the way below the floor here. And that's because we're not colliding with anything yet. So what we need to do is we need to go back to our HDA and add some collision properties to our system. So in order to do the collision, basically we need a way to actually import geometry that we set up inside of our Unity scene into our HDA here. And to do that, we use object merge nodes. This object merge node allows us to basically fetch or go and find geometry that the user has assigned. And so to set this up, what we need to do is we need to set this into this object for the transform option. And the reason being is that this will import the location of the objects in the Unity scene into Houdini here. So it's all relative, basically, which is what we want. So I'm just going to wire this into the third input here on the vellumcloth node, which is for collision. And so now whatever we assign inside of Unity will collide with our cloth solver there. And so I'm going to actually name this. I'm going to call this getCollision. And we need to promote this object one parameter up to our HDA. So let's go and do that. I'm going to go to my type properties. And I'm going to put in a separator for this. You can also use folders or organize this stuff however you want. And then I'm just going to do a middle mouse click and an ALT on the keyboard to promote my parameter up to the HDA up here. And I'm just going to call this collision input, like so. We'll call this collision input just to make it clear inside of the editor and hit Apply and Accept. So now we'll be able to assign collisions to our vellum solver inside of the Houdini engine, which is super cool. And to finish this up, I am just going to right click on the HDA and say Save Node Type. And then let's hop back into Unity and test that out. OK, so to get those changes back here inside of Unity that I made to the HDA, I'm going to go and right click on my HDA here inside of Unity. And I'm going to say Show in Explorer. Then go to the location where I've been working on the HDA. So this is a different HDA than the one that is actually inside the project. Now, you could be working on these particular HDAs. I tend to keep them separate just as backup. All right, so I'm just going to copy this. And I'm going to paste it and replace it there. So now it's all imported or re-imported. So all you need to do is go and select the vellum cloth and hit a rebuild on it. And what that does is it basically updates the internal HDA, all the nodes and stuff to the latest version that we just updated. All right, and you can notice that we get this new collision input over here in the Inspector. Well, this allows us to go and assign any geometry, any static mesh from the scene to our HDA. And what'll happen is the vellum cloth solver will actually interact with those pieces of geometry. So in this case, I want to add all these cubes that I set up here just to act as like cardboard boxes or something like that. And so I'm going to go to the HDA here and say Add Selection. And then I want to go and turn on Roots Only. So I can select just these grouped bits of game objects here. And I'm going to turn on collision objects and accept, and those are all the objects that I actually want to collide with. And in this case, I do want to add one more so you can actually go and add a separate slot. And in this case, I want to go and drag and drop the ground into this right here. So what we need to do now is actually go back to frame one, right? And then sim to something like let's do like 50 and see what happens. So now we're running the vellum solver. It's just that you don't get a real time update or anything like that. So it's just skipping the frame 50, but it's got to go and cook all that stuff. So you can see that our cloth is kind of bundling up over there. So I'm going to go and set this to one. But you know, it's actually kind of a pain to constantly go and toggle this back to one and then having to set the sim time again. So it would be nice to actually be able to trigger that. And you can actually do that inside of the HDA by promoting the resimulate button. So let's go and take a look at that. All right, so I'm going to go up here and I'm going to go and expose the type properties. And we really just need to go to the vellum solver here, then go and promote this reset button right here. So I'm just going to do an alt, middle mouse click and that puts it right there. So let's actually move it up with these other values here. And let's actually put a separator between these two guys. So we have all simulation stuff, then we have size stuff and then our inputs. All right, so I had to apply and accept. And then just make sure you save it. And now we can go and update our version inside of Unity. So let's copy our new HDA or the updated version and paste it over the old one over here. And I'm going to jump back into Unity and a rebuild on the HDA. And you'll notice now we have a reset simulation button, which is great. So I can leave this now at something, let's say like 40. And when I want to update the simulation, I can just hit the reset simulation button and it'll re cook. So let's go now and just move this and then just say reset simulation, let it cook for a little bit and there you go. So now we're starting to fold, but you'll notice that we're getting quite chunky results here and that's just because of our target size. So let's set this down to something like 0.1 and hit reset simulation and there you go. So now we're starting to get something a little more realistic. Let's turn off our wireframe just so we can see this. Yeah, it's starting to look pretty cool. So there's a couple more things I want to do and I have an example already set up here. Let me actually turn this guy off over here and turn on the previous version here. So I want to be able to go and pin certain sides of my cloth, like if I want to tie up this tarp or something like that. Well, I can also go and assign spheres, in this case, I use spheres. You can assign any geometry you want to use as a pinning point and hook it up to the HDA. So that way we can control the look of our cloth here a much easier. All right, so let's go now and take a look at that inside of Houdini. In order to pin geometry on vellum cloth, you need to go to the pin points group right here. So this particular parameter right here is actually looking for a group of points to pin. All right, so if you ever hit this drop down, you'll notice there's no groups I haven't set anything up. So we need to set up that group, right? So I'm gonna go and drag these guys up here and drop down a group node. And the way that I want to do this is I want to allow the user to assign any piece of geometry to select an area of the cloth to pin. All right, I just find that to be a good way to let users interact with the cloth and just really art direct it. All right, so I'm just gonna drop down an object merge node. Again, this is going to import geometry that the user assigned. So I'm gonna call this get pins, there we go. And we need to set this to into this object as well. And then we need to promote this object one parameter. So let's go up to our type properties up here. And I'm gonna create another separator. And this will all be for pins. So I'm just gonna do an alt, middle mouse click there. And we'll call this pin inputs. And I do like to keep these lower case, so pin inputs and pin inputs for the label. And everything else is fine, hit apply. And now in the group node here, we need to set the group name first, that's very important, so we'll just do pin. And we want to change this from the base group to keep them bounding regions. Now this only works with points, so we need to convert the group type to points there. And then we need to change this to the bounding objects. So the bounding objects are gonna be all those spheres or cubes or whatever you assign to this object merge node. And I'm gonna feed that into that first input of the vellum constraints node. And inside of that vellum constraints node, I'm gonna go and select that pin group. All right, so that will allow us to then go and pin the parts of the cloth. So let's hit accept, everything looks good there. I'm gonna go and save my HDA by right clicking on it, saying save node. And then let's jump back into Unity and take a look. So I went ahead already and did a rebuild and updated it, everything looks to be fine. So what we need to do is go and create a new empty game object. I'm gonna call this my pins. And underneath that, I'm gonna create a sphere to act as my pin group. Or the object I wanna use as my pin group. So I'm gonna call this pin 0, 0, 1. And let's go now and I'm gonna scale it down quite considerably. And we're going to then move this over here. And to make this a little bit easier on myself, let's go up to the vellum cloth HDA and I'm gonna set the frame back to one just so I can see where it's starting from. That'll help a lot in on. Also, I'm gonna assign a material I made for this guy, a bright red material just so I can see it easily. I'm gonna call it pin mat. So I'm gonna use pin mat there. And let's now go and put this into position like on one of these corners here. So let's make this a little bit bigger. Just make it easier on myself. There we go. So let's do both these corners over here. I'm gonna go drag it there and then do a control D and move it over here. These two are gonna act by pin points. You need to make sure that it intersects it just so it has some points to select. All right, and then on our HDA here, let's go and assign those two guys. Again, you can just go and get your pin group. So I'm gonna go and add selection, turn on my roots only and go and find pins up here. So yeah, except, and then we can go and resimulate. So let's set this back up to, oh, let's do 50 this time and let that cook. And there we go. Voila, we are now pinning our stuff. So you can even go and add a third one in the middle there. So let's do that. And let's make sure we go and grab our group again. So I'm just gonna go like so and hit accept. And let's just remove the original one there. And let's do a rebuild or I could hit reset simulation. And there you go. So now we've got all three. So you can go and pin it wherever you want. Pretty cool stuff. So the last couple of things I wanna do is I wanna make sure that we get a material assigned to this and then I wanna be able to reduce the poly count because you're gonna wanna go and increase the poly count on these things. I tend to go to something like 0.05 for these and then do a reset simulation. You'll end up with quite a bit of geometry and so I wanna be able to poly reduce that here inside of the editor. And so once this is done, we're gonna take a look at how to set that up. All right, so the first thing I wanna do is just assign the material, which is pretty easy. You can just drop down a wrangle note here and go call this unity material. And I wanna make it so that you can assign whatever material you want, especially for something like cloths, you might be swapping out cloth materials quite a bit. So to do this, you say as that unity underscore material is equal to CHS and the name of the property. So when you say CHS, you're making a string channel. So a parameter that'll exist down here. And I'm gonna call this material, you call it whatever you want. It's really just the internal name for this particular parameter. All right, and so then we need to promote that to our HDA. So I go into the type properties here and I think I'm gonna put it at the top, right? Because that is, you can just drag and drop it as well. That is all the kind of the base parameters over there. All right, so that is all set up. Let's make sure we set that to the primitives as well. It'll still work on points. I usually just put it on primitives. All right, so the last thing I wanna do is go in PolyReduce. So let's drop a PolyReduce node in here and we are gonna set this to by default, let's say 50%. And I want the user to be able to switch this on and off as need be because it is a heavy operation. So might as well let them run the vellum solver without the PolyReduce. So just make the HDA go faster and then when they're ready to reduce it, let them reduce it with a switch node so they can just toggle between the two different states. So switch, reduce. And now I need to promote two parameters from here, one on the toggle, so oral and the switch node here. So to do that, you can just drag and drop this down here and I think I'm gonna put it up here and put a separator between this just so it makes it easy to see. And we're gonna call this the reduce toggle and we'll call this reduce with a question mark and then we'll convert the type of the parameter from integer over to a toggle just so it shows up as a checkbox in Unity. And then we wanna give them control over the amount to reduce. So in this case, I'm just gonna promote the percent to keep for now. You can use the other settings as well for now. I'm just gonna say 50% is the default. So if you go to the channels tab, that'll be where your default is and then this is your range. So I'm gonna hit apply and accept and then make sure to put the display flag on the output and right click on the HDA save to node and let's take a look inside of Unity. And after rebuilding, I get my new options here. So we have our reduce option here. So I can go and turn this on and then set this to, oh, I don't know. Let's do like 20% and see. There we go. So now we're getting a lot less polys, which is perfect. We can even go lower and see what happens here. So you can really stretch that. Let's set this to shaded and it looks pretty much the same. So the other new feature here is the material. So the way this works is you got to go over to the material you want and right click on it and say copy path and then paste it into the option here and hit enter and that'll set it up. So because we set up UVs, this will work. I went through and basically made these materials inside of Quixel mixer and just kind of blended a few things together. It was a mixture of tarp and custom layers with just some noise on top of it and just kind of blended with the bottom tarp material. Same with all the other stuff here. So nothing here is really all that fancy. So anyways, that is how you set up vellum inside of Houdini engine for Unity. Now the really only differences between Unity and Unreal for this, they both basically work the same way as you need to set up. In this case for this HDA, the material assignment needs to be set to the S at Unreal material attribute inside of Houdini. So just keep that in note if you are using Unreal. This totally works in Unreal too. I have tested it myself. Thanks so much guys. See you soon.