CGMK Tutorial - Mineral Boxes (with HIP file)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
here's a quick tutorial on how to create this type of mineral object in Houdini I developed this technique for a personal project called minerals in Houdini and to be honest I was hesitating of creating it tutorial about this because it's really really very simple in this project I created different types of minerals the one that I'm going to show you on this tutorial is the simplest one the other minerals have more of a fractal development if you find this interesting I will consider making a second tutorial about this where I would go through one of the other more complex minerals let's get started so first thing we need to do is create a Geo node as usual and we'll set up our seed object the object that we're going to replicate as a box and I like to work with kind of a realistic type of units so I'm gonna say something like this I want it to be kind of stretched out and this is this is going to be the object that we're going to replicate and it makes sense for us to make sure that this object is as complete as possible so we can go ahead and give it some normals we can also go ahead and give it some movies you and having this what we need is points to copy this object onto so I'll start with one out one point using an ADD node just gonna create one point then I'm gonna use point replicate which is very handy in this situation let's say we'll start with 64 points and let's keep it small let's go to the shape let's say that the size is going to be small pretty contained and let's create a copy two points you okay so we have something now the most important thing we're gonna be needing is to create some some variation on these types of objects this already gives us something but if we want to make this more interesting we really need to have had some variation in terms of the size of the piece the proportions of the piece maybe some rotation to the piece so let's let's see how we can go about it and do that so one way I like to create some randomness is by making sure that the points already have some kind of attribute that I can use on a copy stamp so I'll just create a pointer angle PW to create a pointer angle and this is a very basic piece of code so I'm just going to create a new float attribute float attribute I'm going to call it my ID and I'm gonna say that this attribute it's just going to be equal to my PT num okay so now we can check that our object will have that extra attribute my ID next we'll create our copy stamp exactly the same connections and in here on my copies think you know that we have a lot more options I'm gonna go to stamp stamp inputs and on attribute step I'm going to mention make sure I get my ID for each point I will don't need this anymore and now what I can do is I can use this attribute which is different different for each point and make sure that each point will have a different a different size will generate a different size of box a different rotation etc the way we do that is using the random expression and using my ID as a seed another thing you can do is make sure to include some some other attributes another variable like the frame and that way is whenever you change your frame you you get a different result from from this system let's start with that maybe we can come here to the point replicate which is the first place where we have a seed and as you can see we can already generate a lot of different variations with just playing with the seed so if we connect here the frame to the seed it's gonna type nor F so every time I change my frame my variable is changing the seed is changing and so we get a different organization and distribution of the points another thing we can do is go to the box now picking up on that my ID and the the stamping in fact I'm gonna go to the box and the first attribute that I wanna control is the height of the box let's say I want the boxes to vary it between 0.1 and 0.3 the way I can do that is by doing a feet 0 1 and what I want to fit is fit the random number that I'm gonna be generating with the rent function using as a seed my the stamping variable stem from copy 1 referring to the attribute my ID and I'm I also I'm also going to include I'm gonna add the frame to this as well and also a good idea is to also always add a random number to make sure that if you're gonna be using several randoms then you have variation between them and this is gonna be generating my number from 0 to 1 and I want my variations to go from 0.1 to 0.2 0.1 to 0.25 and is's and we're starting to see some variation already you can be more dramatic about the types of variations that you have here all you need to do is change these values let's say I want to be a bit more drastic go to 0.4 as a maximum and you get some nice stretchy effect okay and the the cool thing about this is that whenever you change the frame you're already getting a lot of variations from this I'm gonna reduce my timeline let's say 24 okay a lot of variations just with this kind of small stamping I'm gonna copy the same expression that's how easy it is once you've done one of these expressions you can just copy it to and change the few a few values and you have you're good to go so I'm gonna copy this ctrl C I'm gonna go to the first parameter the the X size control V and here I was using a value of 0.03 I'm gonna create some variation between 0.01 and 0.06 maybe again more variation and I'm going to do the same thing on the other side just make sure to change the the random number that you're adding to this control C and I'm going to go to the Z size I'm going to keep the same range but I'm gonna change the random number something else okay some nice variations and a lot of randomness easy next maybe add some rotation to the some random rotation if you want I think it works really well with this orthogonal orientation but it might be interesting to add some some variation to the rotation as well so I'm going to what I'm going to do is after these both these operations I'm going to introduce the transform and this transform is just going to be an in order to be able to wrote randomly rotate in the y axis I'm going to use again I'm gonna paste again the same expression ctrl V this time the variation is going to be between minus 90 degrees and plus 90 degrees and again change the number to the random number to something else and come here we see we have a lot of variation again even more variation and you can apply the same system to whatever you want in my case I used it not only for the shape of the box and the orientation of the box but also for the size of the or for the the size of this shape that I'm using in the point replicate so instead of having a fixed size of 0.1 0.1 0.1 I was playing with these values the same way that I'm playing with these values so it's the same thing you just paste the same expression and just change the range and the random number that you're adding to this so let's say from 0.05 to 0.2 and I'm going to use copy this expression I'm gonna copy this expression and apply to everything just making sure I change the random number that I'm using okay so this is how you get a lot of variation I was also using it on the number of points that I'm replicate on the quantity same thing control V and let's say minimum number will be 64 and the maximum number will be 512 maybe here on this shape I'm gonna be a bit more allow it to stretch a bit more on the y-axis maybe even more yeah this gives it a more interesting shape I think and you can play with this as much as you want it as you can see the only you all you need to know is basically this expression as long as you as you know how to generate this expression making use of the attribute that we created then you can the the possibilities are endless so one thing that I found that was kind of boring is that these are all very straight the edges the tips are all all have the same orientation there are several ways that we could go about this but the the technique that I use was it's not very complicated and it gave me the most interesting result I think and that basically just considered consisted of going through all each each connected pieces each each of these pieces and just cut the top in the bottom in a different in random direction first we need a for each loop going to go over each connected piece and then I'm gonna isolate two points of each one of these pieces one from the top and one from the bottom let's first isolate one of these so I'll apply a blast I'll first have a look at the numbers point numbers I'm going to keep 0 and 4 0 and 4 and that way I only have one top on one point on the bottom and one point on the top next thing is I want to make sure that each point has a different normal both normals should be pointing up with a slight deviation so for that I need to create a new point triangle you know I'm going to use this sample sample Direction cone and the sample direction come function uses a vector to to sample to sample of random direction so I'll first create a vector to call my view and I'll use random pitenin plus a random point then I'll make sure that my normal it's going to be equal to a sample Direction cone I have to give it first one direction when we use up zero one zero then a deviation margin in radians and I give it zero point three and I'll use my U and we should see okay so here are our new normals pointing up with a slight deviation perfect let's create our boolean object it's going to be a box remember this box is going to be aligned it's its z-axis is going to align to this normal so offers create something 0.2 0.2 0.05 maybe 0.1 something like this you can use cubic proportions the important thing is to make sure that this is wider than your piece otherwise it's not going to get the whole thing that might be an interesting effect as well but just in case the other thing is that since we're going to be using this to cut and the other the other object which already has some UVs we can also go ahead and just apply some give these two to this space and this and then we can that will make sure that everything is some nice eupbs okay nice you've ease and now you can just go in hand in copy two points the points this is the piece that I want to copy okay this is know this is what we're gonna be using for our boolean and now we're gonna paste a boolean [Music] and just make sure we put this on subtract okay so this is our results our normals I kind of messed up but you can go ahead and apply normal here and just make sure everything is okay everything is you v's all the pieces in our boolean had a V so our final piece has some nice eupbs now the problem is that here to create our random normal we're just using the the Pitt enum and this this number we can also add here the frame like we've been doing before so I'm just gonna add the frame but the other than that the main problem we're gonna get is that we only have two points here and as this goes through each of the pieces we'll always gonna be having only two points 0 & 1 so this variable won't give us much of a difference on each one of the pieces that are that we have on our object currently so we need to make sure that for each piece he will add a different number okay instead of this spinning of a fixed number we need to make sure that on each piece he generates a different randomness the way to do that is making use of the iteration number so we can create this matter import now okay and we can even connect it directly here to the pointer angle on the second input and we can say that instead of using this 1 2 3 we're going to be using a detail value that's here on this object if you go to the attributes and we checked the the parameters the attributes that are available on this node we see that we have an iteration value and it's going to change it goes through each one of the pieces okay so this is what we're going to be using as an extra variable here so I'll just type in detail from input one and the detail we're going to use you can use value we can use iteration whichever you prefer that way we should be we should have some actual variation on the orientation of our normals okay so moving on you get this and now we can just disable the single pass and you'll see that each one of the pieces that we created had have been capped in some random direction some of them are almost straight others are more angular and you can make them even more angular or more straight it's up to you all you need to change is them you just need to change the range here on your pointer angle here in the on the sample Direction cone you just need to increase this and you're gonna be getting a lot more angular shapes it's up to you I'm gonna give you that zero point three point five it's fine now let's make VDB out of this I'm gonna go with the first one okay just type p DB from polygons will use a VDP from polygons wait a fairly high resolution let's say 0.005 to start and then convert VB [Music] polygons yeah we need more resolution bring this sound 0.02 looks good and the other thing is if you don't want to go overboard with the resolution this right now it's really high but if you want to keep it fairly low resolution but have a bit more add a bit more sharpness to this you can always use ray and the Ray will project this geometry on to the original one I'm gonna use this one this is the geometry that I want to project and here I need to put the where I want to project it to and I'm going to use I mean this is another normal to make sure it updates correctly and as you can see before we had this and after the REA we have this a lot sharper same topology a lot sharper you even get some of these I'll call them artifacts but in this situation it's going to give you some nice rendering effects for this type of object of mineral object it's going to give you some interesting effects one thing to keep in mind is that if you're not going to be using the original geometry choose this one you have you v's on this as soon as you convert this to V DB from polygon and cover to V DB you would have to generate new new you v's for this okay can follow the same technique really fast and I think the UVs you'll get from this is still very still enough very workable just make sure you reduce the spacing a lot because this will generate a lot of pieces that's it wasn't as fast as I was expecting but hope you found it interesting let me know if you have any questions and see you next time [Music] you [Music]
Info
Channel: David Ferreira
Views: 3,159
Rating: 5 out of 5
Keywords: houdini, tutorial, cgmk, procedural, mineral
Id: IktTTz0K_0w
Channel Id: undefined
Length: 24min 2sec (1442 seconds)
Published: Tue Feb 26 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.