Introduction to Houdini 16: Creating a Digital Asset Barrel (Part 4)

Introduction to Houdini 16: Creating a Digital Asset Barrel (Part 4)

how'd it guys and welcome to part 4 of this HDA tutorial series on creating a procedural barrel so in this video we're gonna start taking a look at how we can approach creating some UVs for procedural assets so let's go ahead and just dive right in and we're gonna start looking at the core of our barrel first so that will be the staves so we're gonna look at how we can create unique you v's for each stave that makes up the body of our barrel so let's dive into our stave subnet here and let's start taking a look and see what happens if we just throw a UV unwrap on our staves and I'm gonna split my screen up a little bit to make this easier to see some stuff so we'll split this left and right and I'm gonna go ahead and make this my UV view and then I'm gonna split this left and right as well so I can have some quick access to my parameters to see how my parameters affect my UVs alright so now let's see I've got this UV unwrap and it actually seems to be working okay but it's not doing the greatest and we're getting a lot of small pieces it seems to be cutting off the ends and the top here and it's bending which will make it weird for having a would seem because we're gonna want eventually some kind of void material down in the length of our stave and having this deformations here will make that would warp which is not how the material would look in real life or even a stylized version so UV unwrap probably isn't gonna work out for us I'm gonna go ahead and add a quick shade so we can see this warping happening so it's not early too bad the warping is a little bit we can see how like if this were a straight material these the wouldwould if we had vertical wood grains that would just start cutting off here as it went up and then reality the wood would just get bowed out right here as well as on the sides we would get some stretching and this wouldn't run in line with our grain either so a uvn wrap is probably not what we're going to want to use so to fix this bowing problem and make it run in line with our wood grain we can actually go ahead and step above where we have our curve so we could actually start working with our UVs while our stave is straight let's probably go down to where it's centered this is a good place to start so from here we can actually copy this stave thickness and we'll paste it down over here and we'll get the same thickness of our staves but without any of the bow referencing here and we're probably going to want to do a UV flatten and we're going to want this to flatten around the edges here on our stave and we can try doing this manually well press 3 and start selecting my edges and I'll select this loop and this guy is down here and maybe separate these inside pieces in the corner so I have the inside separate from the outside because that won't really matter too much I'll hit enter and we'll get this nice unwrap here looks like I missed an edge so just like that modify it all right there we go that's that's cleaner so that looks actually pretty good and if we put a quick shade down we'll see that we're actually getting nice straight UV s going up and down the length of our stave however we'll notice that as we modified the number of staves ru V's actually will disappear or warp crazily like this is obviously not going to work and this is because the group for our our seem group for our UV flatten is hard selecting point numbers but our point numbers we'll see are actually changing based off of the number of states that I have so I'm going to need to probably create a bounding box or short expression to group the edges of my stave so that I'm always grouping the edges that I had to manually select before for my UV unwrap so to do that just move this stuff down we'll go ahead and delete this same group right there and we'll make a new group note and in this group I'm gonna call this UV seams and this will be stave seams for my group name let's get rid of that space and we don't want a base group that we're actually going to want to include by edges and our group type is going to be edges as well and here we can probably group by minimum edge angle which is the the difference in angle from one edge to another and because we have a slight bow in our state amount here because of the shape its shape as a tube we can probably select by minimum edge angle I'm gonna see that's already kind of working just with the default 20 but if we go ahead and increase this number eventually we'll start getting just the edges that we need and it looks like 87 slightly less than 90 degrees is about what we want so let's drop this down to 87 and we'll see how this is working with the different bow amounts and it looks like it's doing okay height won't make any difference really but we'll check it just in case yeah that looks like it's doing all right and I'm just hitting ctrl + middle mouse button to reset my parameters to their default values and so now that we have our UV seems group we can go back to our flattened and we'll just add that as our seem group for our UVs and then we'll take a look at our quick shade and we'll notice that now I can increase or decrease the number of staves and the height and I get nice UV spread across my entire state so after we get our UV flat and we can do a layout and get rid of this space in between here for light Maps we would want to keep a space here but for the material maps we don't actually need that space so to save up on room we'll do a layout and we'll just reduce the padding to zero and that'll help keep this straighter and closer together and after we get that layout we're gonna need a transform so that for my material I'm gonna I like the wood grain going vertically so up and down so I'm gonna want to rotate my staves to go up and down as well so we'll do a UV transform here and we're gonna rotate this by negative 90 and then we're going to need to change the scale so that it scales appropriately to our index our UV coordinates and we'll see this is now working as we want but we're getting some weird distortions with our scale as it changes that's not too bad so that may not end up being an issue but as it gets higher I want my wood grain to say the same scale because I don't want my wood grain to get bigger as my state gets taller so we're actually going to want to modify this scale so that we can't we maintain a nice square shape as our state increases in height and to do that we actually can use the fit function and rescale this on a range of 0 to 1 based off of my height so I'm actually going to copy my height parameter here and we'll do a negative fit because I still need it to go in the negative direction and I'm gonna paste my reference to my height and we'll go from 1 to 5 because that's the min and Max parameters of my height function height parameter and we'll go from something like 0.5 to 1 like that that's looking better it's almost squares are still a little elongated let's make this a little bit smaller and do 2 3 we're still getting a little elongated but it's looking good up there okay so we're actually gonna copy this and we'll paste that right there and we'll take the inverse of it so that it sets back there and now we're getting nice relatively continuous square UVs as we increase the height of our stave and as well as when we decrease the number of staves that we have that's exactly the kind of behavior that we want for our you v's so now we have a conundrum I've got don't need this UV unwrap anymore but I've got this bowed stave right here and my straight stay right here but my straight stave has the v's and my boat's Dave does not but because we're not actually manipulating the we're not adding new points to our geometry we can actually take an attribute copy and we will just copy the UV attributes from our straight UVs are straight stave to our bowed stave and so on our attribute coffee will see that we're not getting the result that we want right now instead of the attribute to copy we'll set to texture UV and now even as we modify the bow amount of our staves we're getting a really nice very little distortion and straight you v's for our staves so I'm gonna go ahead and delete this quick shade right here and we'll notice that if I go up and we'll look at the revolve for our barrel my I start decrease or increase the number of staves I'm getting a little bit of lag here while I change the number of staves for my barrel and that's because UV operations generally take a mount of time to compute and one way that I like making procedural HCA's that I'm working with faster is by adding an option to my HTA's to toggle my UV generation on or off so we're actually going to go up to my HDA and go to the type properties and we'll go to parameters and I'll just add a new folder over here and I'll call this UV folder and you v's will make this a simple folder and then I'm gonna add a toggle to this folder and the toggle I'm gonna call toggle movies and movies for the label and we'll leave it by default turned off or 0 I'll hit apply and accept this and now I've got a toggle that I can use to switch between my UV generation so I'm gonna copy this parameter and we'll go back into our u-visa channel here and I'm just gonna add a switch to the bottom of my staves output and bring my attribute copy in as the second input and I'll paste my relative reference to my toggle you v's here on my switch and now my stave does not have you these and I can toggle my V's on or off so let's go ahead and leave UV zon so we can see what we're doing and take a look at how we can address this massive overlapping of UV s for our revolve this may not be a problem if what you want is to have each stave have the same UV set they'll all look exactly the same because the UVs are all exactly the same in the same place on our UV map but to avoid the uniformity that I would get from doing my UV this way I actually want to offset my UV s by the length of or the width of my UV space and maybe a little bit more to have the space between them for every new copy or every new state that I have so to do that we are actually going to move these guys up and give ourselves a little bit of room to work and we're gonna make a quick little for each loop so that we can iterate over all of the parts of our stave salon are for each well at our switch to navigate around this operation for our UVs and we'll go ahead and copy this parameter and paste it there again so right now we're still going to be generating movies this so first off if we take a look at our switch here we can iterate through our for each sub block by primitives or by something we have declared as pieces and pieces can be attributes that share the same value so in this case we're going to say our attribute is copy num so for each copy that we have of our stave we're going to be generating or offsetting the UVs for each copy so we'll need to go to our copy and transform and we'll just turn on our copy number attribute right here and now if we go ahead and take a look at our primitive attributes will have a unique copy number or each primitive will have a unique copy number for each state that we have so we're now grouping our primitive incoming primitives on our for each loop by their copy number piece attribute will add our UV transform node down here like what we wanted and let's offset this by the size X so the bounding box of the UV scale in the X direction for our UV space so we can just do dollar size X for our translation amount just like we could if this were a in the geometry space and we'll notice this isn't going to do anything right now it's always going to output 0 because we're not actually iterating over each piece this values not increasing with each new piece so we will need to go to the begin block and create a new import note and I'm just gonna call this stage meta data and now if we go and take a look at our details we've got our iterations and number of iteration attributes that we can reference in our UV transform so we'll need for each iteration it to offset in the X direction by the length and maybe then some to the right on our UV axis will take size X and we'll multiply this by something like I don't know 1.0 – to add a small space and then we'll multiply this by the detail attribute from our stave metadata so we'll grab stave metadata we want the iteration attribute and we'll set the default value to zero and we'll see that now if we zoom out here our UV transform has moved quite a bit so we'll actually want to step down here and we'll see that now we have a straight line of all of our copies for our staves and as the number of states that we have decreases our copies will also similarly decrease and this still seems to work just fine with our bow amount and our height offsets and again when we get pretty low it looks like we get some kind of slight offsets from here it doesn't I don't think that's really going to be an issue that's kind of an extreme so we'll say and call that one good so that pretty much covers how to do the UVs for our staves we can go down to the bottom here and I'm gonna add another switch and I'm gonna add a Yui quick shade here to give the eventual user for my HDA the ability to see how the UV czar effect are working on the asset and if I would take a look at our quick shade that looks pretty good even as we go in scale increase and scale it's looking pretty nice again it's ticking a little bit to do and obviously the UVs are gonna go crazy when we turn our UV generation off because it's just gonna be a projection for our quick shade so we're actually going to want to modify this switch to jump to our output I'm just going to call this barrel out and not use our quick shade based off of whether we have a view UV quick shade parameter here so we'll go back to our type properties and I'm just gonna copy this toggle and I'm gonna say toggle qs4 quick shade and I'll say UV quick shade for the label and I'll hit apply and I'll see we have this UV quick shade now I'm gonna right we don't want our UV quick shade to be usable when we don't have UVs because obviously it can cause visual issues so I'm just going to disable this with a short expression here I'll just say well toggle UV s is equal to zero disable our ue quick shade and now we'll see when i turn you've ease off our UV quick shade is disabled and we'll hit accept there that's fine and I'll copy my UV quick shade here and I can just set this here I'll paste that reference in but now we'll run into behavior that you may not want and I prefer it to behave better than this I have you V's and all generate a quick shade but then I will turn you've ease off and my quick shade is still on but I can't turn it on without turning my UV quick shade back off and this isn't the behavior that we want to happen so I'm going to write a quick if expression in my switch instead to help clean up some of this behavior and maybe it will work a little bit more in our favor so instead of our toggle quick shade right there I'm gonna write if and we're going to grab the value of our UVs and we're going to say if we're even generating movies in the first place then check and see what are you Vee quick sheet value is otherwise just continue on through to our Beryl output so I'll do toggle UVs equal to 1 so we are toggle doing you v's then we'll grab the value of our UV quick shade I'll paste that there oh go away help text alright and else will want to pull 0 and we'll hit enter and so now we are generating movies but we're not having quick UV quick shade on and now we have quick shade on and then when I turn UV is off we'll see you be quick shade is still selected but our switch is still pulling through the first second value because we're not generating UVs to begin with and this is much cleaner to work with than having you be quick shade stay on indefinitely all right so now that we've got the UVs for our staves let's go and take a look at doing the UVs for the barrel rings we have running up and down the length of our barrel here and I'm gonna turn quick shade off a few V's on and we'll dive down and take a look at our Rings so I'm gonna rearrange this a little bit and make it a bit cleaner it's fine this guy can go over there maybe this down here alright that's that's fine and this is gonna have to be moved down a little bit alright so we can do this a couple of different ways one is notice I don't have back faces on the inside here so that makes our job a little bit easier UV unwrapping close primitives is always a little bit more work than open primitives because we already have border seems to help flatten our UVs with here so one way we could do this is by taking our poly extrude here and making a group note and grouping our edges by a bounding box and we could try to resize this maybe make it thin and we could do the bounding box of this and try to size it appropriately with our barrel maybe move the offset here so that we're always selecting this one set of edges right here and then UV flatten that but this system will not always work the way that we want because it the number of edges that we have here could change so it won't always select these edges here well then we'll have to worry about flattening this side on here and I'll just actually go ahead and show you and see how that works so what we did a UV flatten here and we'll see it's already working kind of okay we're getting these rings but they're taking up a lot of room and even if I add my seam group and add it here your arm see our seams already missing this bottom piece here we modify our bow amount and stretch that out a little bit and this is actually kind of working when they're when the barrels more or less straight but I really want what this bottom one is doing for each one I want a nice straight barrel hoop UV for each of my hoops and as my bow amount increases I'm getting more and more curvature with all of my rings and it's seams not really working the way that I want it to so there's probably a better way to go about doing this and as we saw doing this actually seems like it's almost working when the tube or my barrel is straight so I'm actually gonna hop up here a little bit not too far I'm gonna go into my stave and I'm just gonna copy my original tube that I'm making my staves and thus my barrel shape with I'll go back into our Rings and I'll paste that tube here so we're gonna cheat and instead of recasting our Rings to our barrel that bows similarly to what we did with our stave I'm actually I'm just gonna copy this ray and we're going to change the change the target of our array to our straight barrel that is not bowing so straight tube rang two hour straight tube and notice this does not change with our bow amount and this will make them much easier to UV unwrap than previously so we'll copy our poly extrude as well so that we have the exact same extrusion amount for our tubes and we'll actually now that they are basically a perfect cylinder we'll just go ahead and do a UV texture and we'll treat this as a texture type for a cylinder and that looks much nicer and straighter despite our bow amount than what we had previously and if we zoom in actually I can turn on UV overlap so we're getting our boundary seams here I'll turn that off and it's not showing it but if I put a UV quick shade on and we take a look at the sides of our barrel see if one lines up so see how the letters stretch across here we're actually not you Ving the top and bottom edges of our cylinders here but there's no border edge here so we should be able to use the UV smooth to kind of relax or flatten out the UVs for our barrel rings so go ahead and hit the smooth and we'll see that that's already working a lot for us so we can probably decrease the strength of this because we want it to be proportional to how much the Rings are actually set at and maybe decrease the filter quality let's know the scale around one seems to be this seems looking like it's doing okay all right so that's pretty good we probably want to save some space on our material you've ease because eventually I'm probably going to want a texture atlas this so we can do a UV layout and then that will drop all of our ring loops down here to the bottom and that looks pretty nice and now we've got some nice-looking movies for our barrel hoops so really I don't need these guys anymore we can do the same thing that we did with our barrel staves I'll just do an attribute copy and we'll copy the UVs are fixed UVs over to our bent and boat out geometry and we'll do a texture UV copy and that will work out pretty nice for us so something I'm gonna do so that I could help preview my UVs is I'm gonna add a new group and I'm just gonna group all of my hoops together I'm just gonna call this my hoop group catchy and I'll just call this groove oops alright so what that's going to do for me is when I go down here to our quick shade area I want to be able to see the quick shade in a different color because it kind of blends in with my barrel and eventually if I look here I got overlapping UVs but the barrel is going to be wood and these hoops are going to be like a metal or a steel so they're going to be different UV Zoar different materials anyway and at the end of the day I'm gonna texture Atlas it anyway so for now I want to assign a different quick shade color to our barrel ring hoop UVs so I'm just going to copy this quick shade and I'll paste it in here we'll call this one the stave quick shade and I'll call this one the hoop quick shape and for this quick shape we're actually going to need to grab our hoops group well see it's now you applying the quick shade only to our hoops geometry I'm going to need to go up to our stave here let's just grab all of these guys and hop them up a little bit and we'll add a similar group and we'll call this group stave and stave group and now we'll apply this quick shade to our state group and we can actually change which texture map so if I wanted to like preview a simple material on my barrel I could do that and what I'm going to do instead is just go to my reference folder over here and I've got some simple UVs and I'm just gonna make this the blue UV well apply that and now I've got my same UV grid that I can see but it's now colored blue so I can see it separate from my barrel and the bow mount works and we're getting a lot of lag now so you are definitely going to turn you've ease off while we preview everything and I forgot to add the UV switch for my barrel rings so we need to do that we'll drag this down make our switch bring that into there and then we'll copy our UV parameter for our switch input and that should work out pretty good for us so our u V's are all going to be cons of messed up because I'm in the middle of my UV quick shade node but if I step out will turn UV Zahn and then we can see our quick shade or turn you've ease off and a quick shades go away and our barrel is still working like a really nice and now let's take a look at doing the UV generation for the heads or the tops and bottoms of our barrel so we'll dive down into that and take a look at what we have here so for our boolean our boolean is actually after our poly extrude here that's really the head of our barrel everything else is just creating a copy of them and merging them together so we really only need to apply similarly to our stave UVs to one of the barrel caps and then just that as we make copies the UV information will still stay so we'll drag these guys down a bit and we'll add an off branch over here so that we can start creating some UVs and we'll actually just go ahead and make our UV switch now that'll be probably the easiest route so we'll copy our UV parameter and paste that over here and probably the best way to UV unwrap this will maybe blast away the bottom primitive here and we'll just flatten and smooth out the top and we'll see how that works out we may not even need to smooth out the top so we'll grab a blast actually let's let's group by normal will be consistent so I don't have to guess and we'll call this the bottom faces group bottom faces and instead of our base group we'll group by normals in the negative y-direction and we'll bring this spread angle down to zero and we'll see when I go to my group my bottom face is now selected so when we do our blast I will blast away the bottom faces and we'll say isolate top and we'll go ahead and do a UV flatten right there and that's actually working pretty good we can put a UV quick shade down to see so yeah apart from the grain being a little off-center it's doing okay so we can fix that pretty easily just doing a UV transform and we'll just rotate this a bit that looks about right yeah maybe a little bit more mmm yeah we'll just say 23 that looks fine okay it's now I'll take a tocar quick shade and that lines up really nice so we are probably gonna have to do a layout on this so we may not worry about transforming this anyway so let's just not worry about it and we'll fix it later if we need to so now that we've got that side you vide we'll go ahead and let's just copy this blast and we'll just tell this to delete non-selected and then now this one will isolate and for here this is going to be pretty easy we can probably just do a UV unwrap because of projection Allah pretty nice on there and yeah that looks good and again we may need to you transform this later but for now it's not really a bother so we'll just merge these back together what are we getting here ah okay so we've got a three to our quick shade we don't need that up there anymore and our UV flatten is generating some distortion and UV Point ID parameters which we don't need and this one actually caused any issues but for the sake of tutorial I'll show you how to delete them if you want so we'll just do an attribute delete and we'll go to our vertex attributes and we'll delete distortion and UV Point ID and now the warning label on our merge node is gone and we can turn on point numbers and we'll see we're still getting a bunch of overlapping point numbers again so we'll use these to clean up those overlapping points looks like we may need to pull these guys down even further a little bit and then we can just feed this back into our switch so we'll be using output will be up here the exact same only one will now have proper you v's and we can go take a look at our merge here with a UV quick shade on let's go ahead and turn UVs on and this is looking pretty good but again we're getting those overlapping UVs like we had before so let's see if we just do a UV layout and if that fixes all of our problems nope it doesn't look like it's going to fix things for us we'll get rid of this UV layout and we'll come back down here to our merge and it looks like we're going to need to do a UV transform and on this UV transform we'll need to scale our Barrelhead down a little bit say something like that looks like it'll be okay and we'll just move it something like that it should be fine we can move it down a little bit maybe a little bit to the left all right and we'll make a another UV transform on this side and we'll do some similar operations on this so we'll just scale this down maybe 0.5 to keep it relatively the same shape and then we'll offset it over the other end and maybe up a smidge yeah that's that looks okay so we're going to need to if we look at our quick shade we get this again so it looks like we're going to need two for each head offset the transformations of our bottom and top pieces so I'm actually going to copy my UV switch here so that we're not performing this UV operation without any UVs and we'll do a UV transform here and bring that in and we will go ahead and just move this up so that we can see we do indeed have two different pieces and let's actually yeah we're seeing both right here and we'll add one down here and on this transform we'll have this just scale our guys down and again this may not the space is taking up in our material editor won't matter because eventually going to redo this and UV and put them on a texture atlas but it looks like we're getting some nice UV distribution here for our barrels and they're lining out vertically like we want turn you've ease off and it's still doing what we need and actually going to go make the drop this UV quick shade and we'll make our barrel group so that we can apply another UV quick shade material to it at the bottom of our network so I'll call this it's group and we'll that's alright and now we'll go and just copy this quick shade up here and group heads and we'll pick the green one for this now check out our barrel bar grow so do we have it so far and that's looking pretty good so now really the only thing we have left to UV is the hole that right here that's created by our bunghole so let's go take a look at that real quick so we'll dive down into our bunghole and see what we have going on over here so we recall our bunghole is actually being made by this tube and our barrel body made from our staves and a boolean so we should be able to just UV unwrap our tube that we've made and have the UV attributes from the points left over on the tube carry over to the basis for our boolean cut out so let's take a look at how to do that and we're just going to move this guy's up a little bit to give us some room and this is actually going to be pretty easy mmm so if we put a UV project sound and we take a look at the UVs on this this guy we want a cylindrical and that's looking pretty good actually so we're gonna run into a small issue here because let's put a quick shade on to show my suspicions all right so we got this this is what we need and we'll take a look when I do our boolean that those UVs do indeed transfer and we get this nice strip here that you can see again the overlap doesn't quite matter here because we can apply this to its own group later but this UV seem to be transferring pretty great but we have a issue because when I rotate or remove the location of my boolean our UV s go all kinds of crazy and that's because we can't update the we would have to tie the rotation here to match the rotation of our bunghole location and something we can do to go around this problem is actually just move our UV unwrap and are probably extrude around and we'll do the transform operation after the Pelle extrude and our UV s now we'll just make a UV project and set it to cylindrical and now we've got some nice you v's here we're actually going to scale this down just a little bit until we get some nice squares looks good yeah and then we'll see that now when we start performing our boolean we still get this nicely UV enwrapped and as the location moves around go back to our quick shade ru V's are totally fine and we may want to have this guy see – yes he's gonna move up and down around there so we're actually probably going to need to group this and we'll set this as bunghole UV group we'll go ahead and just get rid of our quick shade here and we'll do bunghole you've ease and we'll just do a UV layout on our bunghole you ease and that will clean up that a little bit and then when we check out our operations here it looks like we'll still get pretty good TVs and it's even handling the cutout here for the when we break over into the seams of our stapes let's go and correct on proportions will turn off access a line because it was actually messing up for us and that's looking pretty good don't just step back down to our fuse and now we will go ahead and do a group delete and we'll just go ahead and delete our bunghole you V's group that we made before so we don't need it anymore and then we will make a new group at the bottom and we'll call this bong whole group group whole and now when we step down into our merge so we're getting some errors we have our copy down attribute so we can actually go up to here and we'll just do and see we'll have to do it after this so we'll do an attribute delete and we'll delete our copy not permit of attribute and now our merge warning is gone we'll go ahead and copy this quick shade over again and it will call this whole quick shade this one was our head quick shade and what color do I have left we can just give this a read for now and we'll step down to our barrel out and we're gonna have to okay so this isn't the best way to do what we're wanting to do with a group you see it actually may cause some issues for us because we have some overlapping geometry in our group so we'll actually go to our bunghole and instead of creating this group here we'll go in our boolean operation and we will actually just turn on our a inside B group and call this group whole as we had before and now we'll only be grouping the inside faces of the bunghole cutout which is what we want and now will step out and we've got our whole barrel UV and we can turn the UVs on and off it looks like we're gonna need to go add a UV switch up here I forgot apologies these guys move this down and we'll set all of this is the UV nodes for our operations here so we'll need two switches it looks like so we'll add a switch node here come down and do that and we'll copy UV parameter we'll paste that over here and then we'll just copy this switch and we'll hook these up just like here and now we've got our you v's toggling like they should all right I think that about covers how to procedurally unwrap this barrel so in the next video we'll take a look at how to apply materials in place of our UV quick shades using substance designer


5 thoughts on “Introduction to Houdini 16: Creating a Digital Asset Barrel (Part 4)”

Leave a Reply

Your email address will not be published. Required fields are marked *