Install guide I am proud to present the latest tool I made for Houdini. This time an editor for VEX code! It is a good alternative to builtin editor in Houdini. During development user feedback and requests have been a decisive factor. And yes you can now change font size! This is only one small feature.
|Published (Last):||28 April 2010|
|PDF File Size:||16.11 Mb|
|ePub File Size:||9.17 Mb|
|Price:||Free* [*Free Regsitration Required]|
Just type foo; Hit ctrl-enter, look in the geometry spreadsheet, there you go, float attribute. The tells houdini that you want this to be an attribute, the default type is float. You want it initialised? The default is float, so you rarely need the f prefix. All the attributes you see in the geometry spreadsheet, you can access them by sticking in front of their name. You want it 1. Eg to set the red channel of each point to the sine of double the x position: Cd.
To ensure Houdini does the right thing, prepend the type. How do I iterate through the geometry? When you have lots of points, Vex runs that same code on all the points in parallel, substituting the values for Cd and P for each point automatically.
Create UI controls Say you have this: Cd. I end up using loads of these all through my setups. It assumes the incoming values are in the range, you often have to fit the values before feeding to the ramp.
The fit function goes fit value, oldmin, oldmax, newmin, newmax. Eg, remap X between Define the start and end points with UI sliders!
Once the channel is made, you can right. A handy thing I often do is to convert the default vector channel to a colour channel. Most handy. Example: Wave deformer A classic. Got your 40x40 grid ready? Change the previous line to read: P. To make the waves animate, add time to the inner term.
Lets make it negative time: P. Instead, you can create variables that only exist within the wrangle. Worlds collide! Rotate a single point with sin and cos Say you have a single point at the origin, and you want to animate it going round in a circle.
Sin will give you a smooth wave between 0 and 1. Cos gives the same, but offset by half a wavelength. If you drive x by sin, and y by cos, and make the input to both Time, the point will move in a circle: P. Maybe we can add this to the existing P, and it will rotate? Rotate geometry with sin and cos The problem is all the points are getting an identical rotation value. What we need to do is get the offset of each point, but as a rotation offset.
Casting your mind back to high school maths, you can use tan , if given the x and y, will return you an angle. If we measure the length just using P. Rather than rotating all points equally, what if you scaled it based on radius?
You get a twirl. Another way to do rotation is with a matrix. The other two things are easier to explain in code: So what we need is a matrix, and a way to rotate it. Amazingly, the function is called rotate. We then define the axis to rotate along, and the amount to rotate. Then we call rotate, which will modify the matrix m directly.
Finally we multiply it against P to apply the rotation per point. A nice bonus of using matrices to do rotation, is that it maps easily into orient. When using the copy sop or instancing, if they find an orient attribute, each copied shape will be rotated. You treat the edge as your rotation axis, and rotate as shown earlier.
If you remember your vector maths, to get the vector between 2 points, you subtract them. The rotation has to be centred at the midpoint of the edge. This is a vex call that constructs a transformation matrix similar to what a copy sop creates per copy. This means you can feed it position, orient, pivot etc, and it does what we want.
First, the prims will have to be split apart, so use a fuse sop in unique mode to do this. Then, to get the 0 and 1 point per prim, you can use primpoints , which will return an array of the points in a primitive, in order. A simple way to fix this is to just move those primitives to the origin, do the rotation, then move it back. Generally when you use vectors for rotations, or use vector functions dot, cross etc , they have to be normalized, that is, the length of the vector has to be 1.
Thanks for the heads up Martin! Wrangles vs hscript vs vops vs everything else Vex is as a general rule always going to be faster than using hscript, and will scale much better. Vops are great, but often its the simple things that you can do in 2 lines in vex, that would take 7 or 8 nodes in vops.
Re other sops, a wrangle can do the work of several other sops, often more efficiently, with the ability to make UI elements easily. Some examples: point sop - a lot of older tuts use point sops. Just say no. That little plug button is the best thing ever. Whatever attributes you wire into the snippet are now visible to the vex editor, without using prefixes. Eg, here I want to drive P.
If you want the colour of the current point, you use Cd. But what if you want the colour of point 5? You have Cd on a grid, you want to blur it.
One way is to iterate through each point, look at its neighbours, add up the result, and divide by the number of neighbours. You need to tell it how it will find values in the cloud, It searches to a maximum distance 1 , and returns a maximum number of points 8. Here, we tell it to use the cloud we just opened, and look up the Cd attribute. Because pcopen returned the closest 8 Cd results near the current point, pcfilter will return the average of those 8 points.
Also note that pcfilter does a more clever job than the neighbour based method earlier, it knows to give far away points less importance than closer points. Another use for this is vex based smoothing function, try this on a box in polygon mesh mode with lots of axis divisions.
Just type foo; Hit ctrl-enter, look in the geometry spreadsheet, there you go, float attribute. The tells houdini that you want this to be an attribute, the default type is float. You want it initialised? The default is float, so you rarely need the f prefix. All the attributes you see in the geometry spreadsheet, you can access them by sticking in front of their name.
Formation Houdini FX – VEX sur site