Houdini VEX and VOPS: A Comparison

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
either welcome to the vets and Voxx Houdini tutorial from line between now this tutorial is drawing comparisons between FX and vlogs explaining what each one is painting how they are used and then we're going to create a setup in both and show you exactly are those two are similar and how they are different so that you can get a feel for whether you want to approach Houdini from the angle of effects or whether you want to approach it from the angle of thought so a good starting point would be what is vex orbs X stands for vector expression language it's the coding language used in Houdini now a coding language is just the way to communicate with a computer Victor would like this if you have a neighbor who doesn't speak English they speak their own language say they are Spanish you would need to learn Spanish to communicate with them much like with the computer you have to learn the computers language to communicate with it so vex is Houdini's computer language right it's it's coding language and we can tell who do you need to do certain things using that language now Bob's stands or the vector operators now you can already see how those two are linked if X is a vector expression language Bob's vector operators right so Bob's are basically little chunks of X code packaged as nodes so flops would be the node based way of doing all the things that you would do in vex which means that if X and verbs are interchangeable they're the same thing more or less in different forms and to really understand this we can go ahead and open up we D so in Houdini I'm grants go ahead and drop down a geometry node and obstacles whatever effects got comparison we go inside here and we can drop down and attribute evolve though now that we have an attribute clock you'll notice it has some inputs now we don't have anything for it to run over usually it would run over some points or primitives and inside of the block you change things like color or an attribute or whatever it may be we don't have that so we're changing this to detail that means it just runs as a standalone node or it doesn't affect inputs it's just affecting detail so dive inside here you'll see that by default it gives you these two nodes over here these are global variables these are things that you can bring it like the position in space so if you were bringing in points as opposed to running over detail you would have access to all of this information from your point so the p value that's your position the velocity force age life all of that right we know need this were running over detail so you can delete that what we are going to do is create two constants we're just going to take two numbers write x and y multiply them together and output the product what does that look like well we have a constant we can give it a name we call it X it also has a type in this case it's float and a float is just a number that has decimal places so it could be 1.1 1.2 5.6 whatever it is right and to understand this better in contrast to an integer we can test out a float of 3.2 and then try changing this to integer is not happy with 3.2 it just sets it to 3 all right it has to be a whole number so we can set this back to a float make this 3 you can also drop another constant right over here call this 1 why make it 2 then we can multiply these together because remember we wanted to multiply them and get the product we multiply them together we can just call this x times y and then we can create a bind export over here which binds it to an attribute so we put this into the input and then you can call this something like product so it goes 3 times 2 and give your product rigor upper level we can actually take a look in our geometry spreadsheet we should have a detail attribute called product which gives us 6 expected nothing crazy now if we go and create an attribute angle oh just like attribute Wrangell or aw for short you'll notice firstly we also have four inputs we also have run over points which we can change the detail as well and then said I'll display a flag on here and here we can do the exact same thing we can say float x equals three and then we put a semicolon that's like a full stop right it's saying this is one piece of code this is one thing to execute and you can move on to the next thing new sentence basically Lert y equals two semicolon and now we can do something like at product equals x times y semicolon now at this ad syntax is just telling Houdini that this is an attribute if that attribute existed before as well adjust the attribute if it didn't exist it will create a new one the ridge is saying paid an attribute called product equal to x times y and if we go over to our geometry spreadsheet on our attribute Brandel we also have this as you can see these are two ways of doing the exact same thing and now you may not exactly be able to draw any sort of concrete conclusions from this or any sort of Preferences because this was very basic right we were just working with some numbers let's actually create something let's create some spirals right we'll create some points and turn it into a spiral and that spiral can be controlled with a few parameters that would be a cool thing to do and it would be somewhat intermediate so let's remove these two nodes and let's give this a go so this time actually gonna start with an attribute wrangel so let's drop down aw attribute Wrangell put it down there once again we're not going to be working with any input you can just change this to a detail over here in your Bex expression editor you can hold alt + E to bring up this little box and this just gives you some more space to type that's pretty nice first thing we're going to do is we're going to define how many points we want in our spiral so let's say in two points right which making a variable you can think of it like that constant we had earlier but this time we're going to make it equal to channel integer and a channel integer is going to be called points and I'll show you shortly exactly what creating a channel integer looks like but this that we're doing over here which is creating a function so so anything that was color the sort of teal color is a function so this function is the channel integer function it does a bunch of code behind the scenes that you can't really see next we can also create an angle and this is the angle between each point so floats angle equals channel float this time so CH F and we meters call this one angle I'm just going to show you what this looks like we can apply and accept and it won't do anything yet because we have to actually tell who do you need to look for these channel references go over here and say creates pair parameters and down at the bottom we now have points an angle and we can adjust these whatever we want so we needs at least to like not point one and a hundred back in here multiple us II bring this back up we're going to create something called float R and we just initializing it for now so initializing just means we're creating it to be used later we can also create another float called floats later and two more floats float X and float Y and you can separate your two with a comma which is quite a nice little thing that you can do and you can make those two equal to zero now we can also initialize a position because we need to be putting these points at a certain position that we don't know yet so we'll be creating it later but for now we can make something called vector pause which is equal to zero comma zero comma zero it's a three component vector you can just easily put it like that now we need to create a for loop because we need to run over each point and decide where that point needs to be placed and then place it here we say four and then in here we create an integer called I which is to start with equal to one and we say as long as I is less than the total number of points we have and do the following and each time we've completed doing the following increment I up so that means increase I so that it runs again until this condition over here is met so the first thing we're going to do is adjust our R value the R will equal 2 times pi and you can do dollar pi times I divided by points now I wouldn't say why about this is too much this is just basically for fading a spiral this is a bit of an equation that I had to recently figure out don't worry about it too much this isn't really the point of e tutorial the point of this tutorial is VEX versus pops I'm just trying to explain it so you can at least follow along we then have theta we want to make theta equal to angle x I now remember I increments up each time this code is run so for the first point I will equal 1 for the second point I will equal 2 for the third point 3/4 point 4 and so on and so forth alright and so by having this you have evolving values each time I is incremented up these values will change to adjust and then we just make X equal to R times the cosine of theta we can make y equal to R times sine of theta and this is generally how you'd make a circle you would have cosine of a value and sine of the same value driving X&Y and that'll make a circle on a single plane if it's run over a full period next we say pause equals set so this is a function once again X comma Y comma zero and then the last thing to do is to add a point at that position so we say add point 0 comma pause and if we apply and except what you'll notice is that we've created a spiral of points and there should be a hundred points and if we middle mouse on our attribute angle you'll see points 99 and that's because we're starting at I equals 1 could change after I equals 0 100 points ok the problem that okay so we have this and if we increase some points it spirals out and if we decrease them comes closer in all right so pretty cool we can set this to just 100 points and now the moment that we've all been waiting for and you do the exact same thing involves because right now all of this code might seem very confusing to you and this isn't very intuitive because you don't like code or you might not have coded in the past whatever it may be and you would rather do this in box you would rather do this with nodes it's very much possible so let's create an attribute pop over here once again we're going to run over detail we can switch our display flag over to this attribute block and dive inside remember we don't need these it's we can delete these so what did we start with before what we started with the number of points that we need so what we're going to do is create a parameter this time or the number of points so the name of this parameter will be points and it will be an integer right remember it a channel integer for points and so this has done the same thing now and the label for this can also just be points then we also needed an angle so we create another parameter we call this one angle give it a label hog angle and this one will be a flirt so that's fine so we've got our two parameters and they show up over here so we can put 100 points an angle at Northpoint 1 and now these two values match up and we're good to go so we first did some maths we calculated our r-value so let's do that quickly R was equal to two times pi so we can quickly figure out what K is it's used a trigonometric function set this to our cosine and our cosine is equal to PI at negative one and the reason I know that is because I googled it's not because I'm good at maths I don't worry a lot of this is it because of good at maths is because I just search these things so high right we get PI from that that's cool we then want to do multiply so we can drop a multiply constant we plug that in and wanted to multiply it by two so this gives us two pi and we can call it that we can then create a null over here and call it R so that we know that this is our over here and the output name we can also call our right so it's easier to work with now we have points angle as well as our R value and we can just line these up over here and isn't the starting to look a lot like this vex code we have points angle are so now we can also create out theta value now our theta value was actually created inside of a for loop so we need to create a for loop so let's create a for loop and the way of all your works is however many inputs are given to it it will run over whatever nodes are inside of it until it has completed at the number of times as the input requests so if we plug points into the length index then it will run this the number of times that we have points and so we can actually just add a point in here and if we plug link out into the handle then PT Nam into out what ends up happening is we generate a point for each of the number of points that we're putting in so what does this look like if we go up the level and we middle Mouse on this we now have a hundred points being generated because what it's doing is it's taking this value here and generating points oh cool we have that but all of our points are just placed right over there at the origin because they don't have a position so how did we calculate position oh we have to do some maths to figure out X and y so we can do that again so the first thing we'll calculate is our theta value and what we'll do is we'll convert this integer to a float so we'll do int to float so this inter float will take the index out this is the equivalent of that I value that we had where we said in I equals 0 I less than points I plus plus every time it runs over this this index value will increase so that means we can treat this as that I value next we can drop a multiplier because remember we multiplied this by our angle so we multiply this by our angle and that's actually the reason why we use this int to float because these nodes assume that the output is the same type as the first input so if we didn't change this to a fluid and then we multiplied this by our angle I would have given us an integer because this was an integer coming in so that's just a little thing to take note of but nothing too complicated so what that actually gives us is theta so we can put this over here like this in call this theta we used a null to hold the value and we've called it theta and we can also just change the output name to theta so now it outputs theta and so what did we do with theta well we use that for a sine and cosine value so we can drop a sine broth over here and a cosine graph below it and this will let us calculate what exactly cosine was for X and sine was Hawaii we plug theta into X beta into Y and then we want to put that to position but before we do that we have to multiply this by our but if you take a look back our value first needs to be multiplied by I divided by points so we can do that very easily we firstly need to divide where we divide I bye of points that grab the eye over 500 and then we multiply that with our value so our times that and then the last thing that we do with that is we multiply our X with our to multiply ow why with our that gives us our final x and y values and then all we need to do is do a float to vector loads a vector will take these two values that we have and convert to a vector so component one would be X component two would be Y and then component three we can either zero and if we plug that into our position for our add points it should work but it's not and yeah that's that interflow thing that tripped us up a little bit earlier switch that into float into your divide one input one and after all of that we have a spiral and it's the exact same spiral as I ought to be triangle that you can compare these two and each one of them has these values that we can now control and so each one is exactly the same so after all of that we now have a strong understanding of of X compared to Vox now in my opinion this is very easy and clean and lops can get a bit messy and complicated of course you could press control V you know lay it out nicely with L and then everything looks a bit easier to read and it's not such a mess right and that's fair and if that's your thing then go go for it I have no issue with that and you'll get along just fine in Houdini but do keep in mind when you're set up start to get complex with wops they can start to get really complex you know these fifteen lines or so of code are supposed to these nodes I find this easier but that's just personal preference what could you do with this all let's just turn it into something interesting if you drop an ADD node and add it by group and then duplicate it over by holding alt you can have these two you can merge them together maybe the one should have more points that it spirals more you also give this one more points I'm paying like that that looks kind of cool and then maybe two different poly wires one over here click and drag over one into there each one with four five divisions and then you could maybe do a wire radius of nine point nine five on the smaller one you take a one at color maybe so let's make the thicker one if blue and subdivide more faces attribute glue and we'll do it by proximities that gives us some interesting shapes and just do maybe a bend node or something with a capture I lost one and minus five let me just increase the points even more on these do 500 and 700 what we can do is just put camera an environment light give it an HDR eye and maybe put an area light over here and so this is just so that you know you actually have something to show or following along with this because this was really just to give you an idea of the comparison oh look at all of that you can very easily just drag over a gold shader and you end up with something interesting yeah I hope that this helped you understand our attribute wrangles and attribute lumps are pretty much the exact same thing really it's a good idea to understand both attribute watts I love data for noises like I don't think I've actually ever created noises in an attribute wrangle but I do it all the time in an attribute walk likewise I don't think I've ever done anything heavily mathematically based in an attribute Locker just because I find it easier and one to two in fact and easier to follow with and so yeah you know I know some of the best Medini artists actually just use walked like sign the whole middle from an oddly used to work at man versus machine he uses attribute box and his work is insane so don't think that this is like a simplified method or the dumbed down version of booting that's not at all it's very much an equal and it has its benefits but you just need to weigh it up for yourself so I hope that helped you and you can't get away with using either one though knock yourself out have some fun and I hope you enjoyed this tutorial this was bit of a different style so let me know what you think and finally just always say goodbye thank you to all of our patrons thank you for watching and I'll see you next time bye
Info
Channel: Nine Between
Views: 14,429
Rating: 4.9678974 out of 5
Keywords: Houdini, vfx, cg, cgi, houdini tutorial, intro to houdini, houdini basics, houdini learn, learn vfx, learn cg, learn, sidefx, blender, visual effects, computer graphics, digital art, maya, vfx basics, introduction, 3d, 3d tutorial, basic 3d, houdini 3d, vex, vops, houdini coding, coding vfx, coding vex, houdini vectors, houdini vops, vop
Id: JH7ERh-qIIk
Channel Id: undefined
Length: 23min 12sec (1392 seconds)
Published: Wed Apr 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.