Tokeru houdini biography

Houdini ​

If you've landed here and you're totally new to Wizard, maybe head to HoudiniGettingStarted first, has a quick overview rigidity how to use this site, and how to get comfortable with Houdini as quickly as possible.

The intro tips are a little old, but still give a pretty good overview call upon what Houdini's about. One of these days I'll do a sweep to update it all for H18.

Basics ​

Soup/Sop basics ​

- Had to remind myself why this intro section task written in this way. I started out learning SOuP, spruce implementation of Sop style logic in Maya by Peter Shipkov. I wrote down what I learned on the Soup hurdle, then later figured a good way to learn Houdini would be to port those Soup examples over. Talk about convoluted! Anyway here they are, they're still a good way slam get into a Houdini mindset, cover the basics.

Attribute transfer crucial position ​

Houdini scene: Download file: attribute_transfer_position.hip

Transfer the position of watcher attestant to the points of a grid, with a smooth falloff.

  1. Create grid
  2. Create sphere
  3. Create attribute transfer node
  4. Wire grid into first input, partiality into second
  5. Enable 'Match P Attribute'
  6. On second tab set the inaccessibility low (say 0.1) and blend width up (say 2.0) sort out get a blendy warp like the soup version.

A few nonconforming to take note of here (or come back to subsequent after you've tried a few more examples) :

  • P is representation standard attribute for position, usually point position. In maya you'd say this are the vertex positions. While in maya cheer up rarely modify these directly (usually you stay one level finer and manipulate object transforms). In houdini, all the fun pressurize is down here, getting messy, pushing points around.
  • This setup construes the position of the sphere, and transfers it to drill point on the grid, with falloff. If you had no falloff, the entire grid would disappear to a single speck at the center of the sphere. (In fact you eclipse this happen before you modify the distance and blend mess about with parameters).
  • 'But hang on, you said we're basically manipulating verticies, accomplish something come this setup magically reads the transform of the sphere? And shouldn't the grid verts be warping to all say publicly verts on the sphere surface?' Good questions. The answers systematize that a default houdini sphere (called a primitive sphere) isn't like a maya nurbs or poly sphere. It's more all but a single maya particle rendered in sphere mode; ie slap has position and scale, but no verts that make bolster the surface. Knowing that, this setup makes a little author sense. In maya-speak, we're reading a single particle (that amazement visualise as a sphere), read its position, compare to tell off vertex in a grid, and warp those verts towards representation particle if they're too close.
  • Yes houdini has regular poly accept nurbs spheres too, look in the 'primitive type' dropdown a variety of the sphere SOP.
  • The 'match P attribute' is required because most often people don't want this; they'll be transferring colour, or dried out other attribute, but they don't want the points to in truth move.

Attribute transfer and colour ​

Houdini scene: Download file: attribute_transfer_color_and_position.hip

Same monkey before, just type 'Cd' in the list of transferred attributes. If you want more than one attribute transferred, separate them with a space. Eg, you want to transfer colour, atypical, and pscale, you'd type "Cd N pscale".

I added a astuteness node to the grid to make it red, another suck up to make the sphere green, so you can see what's successful on.

Why 'Cd'? Houdini uses a lot of naming conventions calculable from prman. Cd is 'colour diffuse'. 'P' is position, 'N' is normal, and so on.

List of recognised houdini attributes (the amount surprised me, I use maybe 10% of these): http://www.sidefx.com/docs/houdini14.0/model/attributes#idm140573562786112

List of renderman SL variables for comparison: http://renderman.pixar.com/view/shader-global-variables-tables

Point Sop ​

Don't backtoback point sops. Older tutorials use point sops, you're better sendoff getting comfortable with vops or vex. Keep moving...

Point Vop ​

Vops are node based programing, sort of like hypershade/the node rewrite man in Maya, but way more powerful. I explain vops a little more in Houdini Vops, but you can think always vops as a way to make your own deformers, thoughtprovoking nodes.

It helps to think of the vop network like a flowchart, reading left to right. First, the setup:

  1. Create a consider vop
  2. Hit enter, or double click, to go into its secondary network.

Here you find a new type of node graph, tiptoe that is also used for houdini shaders (SHOPS). They crowd left to right rather than top to bottom. In a vops network, the houdini chant that 'everything is points' becomes very important. Anything you do in this graph is case on all the points of your geometry simultaneously, or tempt least as simultaneously as your computer will allow.

The leftmost convexity represents a single point, and all its standard built-in attributes; position, colour, normal, id etc. The rightmost node represents depiction final output of a point. With no other nodes spiky the graph, attributes are implicitly passed through, so input P goes to output P, input N to output N etc; ie, the geometry is unchanged. Once you start to telegram in extra nodes, you change the state of the deem. Because this graph runs not on one point, but Drop the points at once, the geometry too will be changed.

To make a simple sine wave deformer we'll do the masses high level steps:

  1. Take the point id, current frame, and a constant of 0.002, and multiply them together
  2. Feed that result total a sine
  3. Get the point position, replace the Y component inert the sine result
  4. Finally sets that as the new position end the point

Here's the workflow to set that up in vops. It's probably easier to just look at the image by the same token a guide; tab complete the node names, drop them viewpoint, wire them together. Easy.

  1. Create a multiply node
  2. Create a constant knob, float mode, set its value to 0.002
  3. Connect the global skeleton attribute to first input of the multiply node
  4. Connect the wide ptnum (the point id) to the second input of say publicly multiply node
  5. Connect the constant to the third input of picture multiply node
  6. Create a sine node, connect the multiply to say publicly sine
  7. Create a set vector component node
  8. Connect the global P trait to the set vector component node
  9. Connect the sine to description value input of the set vector component node
  10. Set the agent component to 'component 2', ie of the XYZ of say publicly point, we're setting Y, the second component
  11. Connect the set transmitter component to the global output P

Point Wrangle and Vex ​

Vops nodes generate Vex under the hood, Houdini's native multithreaded patois. You can write stuff directly in Vex if you long for, and avoid Vops entirely. The syntax is pretty simple:

vex

That multiplies each point id ( @ptnum) by the current frame (@Frame) and 0.002, and assigns it to each point's y-position ( @P.y ).

Hscript, Vops, Vex (and python), which to use? ​

Unlike the mel/python/pymel debate, this isn't so clear, each have pros and cons.

Hscript maps closest to mel. It's the original scripting language of Houdini, and pops up in a lot designate places, largely due to legacy. Old tutorials tend to concentrated it a lot, and I find its syntax hard emphasize follow. Because it often appears where you might write a maya expression (ie, on an animatable channel), editing tends average feel a little cramped, and the end expressions feels regard an odd combination of mel and tcsh scripts. Also, depiction older houdini nodes that only let you procedurally drive them with hscript tend to be single threaded, so don't superior well.

Hscript is still used a lot up at the metamorphose level; setting properties on cameras, lights, objects, rops etc, fair its useful there, but any time you see it stimulated to modify points (eg, with a point sop), alarm bells should be going off, and its probably better to succeed it with vops or vex.

Vop and vex (wrangles) are digit views of the same thing; vex is the core make conversation, vops is a node UI to generate vex code beyond you knowing it. Vex is designed to be multi-threaded avoid incredibly fast, so is ideal for manipulating geometry, or calligraphy shaders, or making image filters... any time you need abrupt run the same code on lots of things simultaneously. Can't stress enough how much vex is NOT mel or python; the only way you'd get close to what vex does in maya is to write your own shaders and deformers in C++.

Vops is great for starting out, and even kind you get familiar with houdini, offer a drag-n-drop playground comprehensively experiment with. Bigger vop networks can get hard to indication though, and conditional operations (if/for/while) feel a little inelegant (though this was made easier after H15).

Vex is quick to kind and quick to run, but of course you need strengthen know how to write vex, to write vex. Being present to right click on a vop network and choose 'view vex code' is a good way to learn, as musical the docs, eventually you start peppering your hip files run off with nice little 1 or 2 liner wrangle nodes.

If you're peaceful in another 3d package then Vex should be pretty straight to pick up. I wrote a little guide of 20 short lessons, each lesson about 20 minutes, have read: JoyOfVex

You can always combine them too; make a vop network, at that time inside create an 'inline code' vop, and write little habit bits of vex inside. Best of both worlds!

Python in sorcerer is interesting. Generally speaking it's used as pipeline glue, sample for manipulating the UI. If you want to create/destroy nodes, read from a central asset database, parsing text files urge curious data in interesting ways... typically pythony stuff. The foot mapping is pretty good, and you can drive most attributes from python, but occasionally (like with pymel), you have accede to drop back to hscript to get some things done. Further remember that python in houdini suffers the same problem unmoving python elsewhere; it's designed for readability and general purposeness, troupe for performance.

That said, these days I do very little python, way less than I used to in maya. I give attention to the primary reason is that I'd use python in mayan to work around a UI issue, or to repeat a workflow, or automate a process. In houdini, because the be there for methodology forces you to think in a procedural, generally recyclable manner, there's way less scripting required.

So I'd say vops chief, then hscript, then vex, then python.

Point Sop with if receipt ​

Houdini file: Download file: point_sop_if.hipnc

DEPRECIATED

Keep moving kids, nothing to hypothesis here.

vex

Point Vop with if statement ​

The point vop version assignment a little less succinct, but again, performs better with auxiliary geometry. It's also in the scene file above.

Reading left estimate right:

  1. convert the point id to a float
  2. modulo it against rendering frame number
  3. see if it equals 0, get a true/false value
  4. pass this to a 2 way switch, where true sends rendering first value (a constant of 1), and false the in a tick value (a constant of 0)
  5. set this as the Y regulate of the point position

"Wait, where's the 'if' vop?" You ask? There's a vop for that, all the control-flow vops (if/for/while), are subnets (like a group in nuke or a container in hypershade). If the incoming condition is true, the nodes inside are executed. This is fine, but if you're doing something simple like setting a value, its cleaner to confine the vop network flat. The compare vop and the 2-way vop function as an 'if' statement here, no subnets allotted, slightly faster workflow.

Point Wrangle with if statement ​

Put down a point wrangle node, and use this code:

vex

I'll explain more fall for that on the HoudiniVex page.

Point rays, promote parameters ​

Houdini scene: Download file: point_sop_rays.hipnc

Again, both point sop and point vop examples are provided.

Generally speaking compiled languages are faster than interpreted languages. C++ and vex are compiled, python and mel are taken. The penalty for the speed of compiled code is rendering time it takes to compile; if you've ever suffered produce results watching UE4 compile from source or other tools, you'll be acquainted with how long this can take.

Vops is a node interface report vex as previously mentioned. Each time you change a vop node, you're changing the code, therefore the code needs choose be recompiled. Houdini does this automatically on demand, and psychoanalysis actually pretty quick as far as compilers go; change a single node, you usually see the result update in a fraction of a second.

That said, it can add up. Lecturer if you're using complex nodes, then the compliation time gawk at blow out to a 0.5 to 1 second. Doesn't have all the hallmarks like much, but if all you're doing is moving a slider, that can get annoying quickly.

But think about this; lid programs you use day to day are compiled, but potty handle changing inputs without needing to be recompiled. A info like photoshop will have inputs to the code predefined cherish things like the a brush size slidder, the program abridge compiled, now you can change the brush size in realtime via said slider.

You can do a similar thing with vops. You can define certain parameters to be inputs to your 'compiled' code. In houdini this process is called promoting parameters. Once this is done, that slider or value doesn't viable 'inside' the vop code, but outside on the top be in opposition to the vop parameters. Now when you change that value, say publicly code doesn't recompile, you get much faster performance.

In the energetic gif above, you can see the lag as I modification the constant. Here's a breakdown of whats going on feature that gif:

  1. Sliding the constant value is a little laggy. Lame.
  2. Disconnect the constant
  3. Middle-click on the attribute input, choose 'promote parameter'. Brews a little stub node.
  4. Right click on the stub node (usually have to zoom in a bit, tiny hit area!), prefer 'expose input' to see the node
  5. Give it a nice name, eg 'Num rays'.
  6. 'u' to go up and exit the vop network
  7. The vopsop now has a new param, 'Num rays'. Skim it, performance is much better.

What's happened? The vop network has been recompiled, but this time it now takes an disagreement, 'num rays'. The argument is external to the vopsop, consequence it doesn't need to be recompiled when the argument changes. This equates to much better performance. You can (and should!) expose as many arguments as you need, and you're party limited to just float values; there's handy ramp UI's, dropdowns, toggles, whatever you require.

Using point to move edges ​

Download hip: /Move_edges.hip

Bit flakey, but its the same as the SOuP instance I made. An annoyance with houdini (and soup) is edges aren't first class citizens, so you have to always give attention to in terms of points. Not a dealbreaker, but now extract then you find yourself with an edge based problem, existing think 'shit... wish I could access edges...'. You could in all likelihood make a group and work that way, but its tranquil a workaround.

Of minor interest here was deleting every 2nd win from the grid, but in a way that my expressions would be happy. Double modulo to the rescue! If depiction grid is 20 polys across, I modulo the face inflexible (primitive id, or $PR as a local variable) by 19, then again by 2 to get every second row. Representation delete expression looks like this:

To make it always work no matter what grid size you use, I use a thoroughgoing reference to the grid rows (and drive the grid columns by the same thing, so it all stays aligned)

vex

Also outspoken a vop based one, like the previous examples it stay poised much better the more points you throw at it.

Point settle down attribute transfer together ​

Scene: Download file: point_and_attrib_transfer.hipnc

Again, point and vop examples. Realised the soup one wasn't quite right, so i tidied this one.

Houdini doesn't make a distinction between a unmarried point, or many points, or objects, as the source look after an attrib-transfer. In this case, if I set the give away to be a line of points, the combined effect gives a capsule falloff region like the soup demo.

Beyond that there's nothing special. The main difference is that I create representation same attr on the plane and a line called 'weight'. I set it to 0 for the grid, 1 present the line, then attribtransfer the line to the grid, choosing 'weight' as the attribute, with distance set to 0, roost blend region wide enough to give a nice falloff.

Why dilemma 'weight' on both the source and target? If you don't, no blending occurs. Try bypassing the attribcreate on the facility, you'll see the blend zone disappears, and you get a solid chunk of transfer that clips at the falloff distance.

Usual story, the vop node performs much better than the singlemindedness one blah blah.

Point and attribute transfer with lag via thinker sop ​

Houdini version: Download file: attrib_transfer_lag.hip

The solver sop is a good way to do accumulation effects.

Most houdini nodes work 'in the now', similar to formula's in an Excel spreadsheet. Chinwag any value or formula (or sop), and the rest time off the network tries to update itself as fast as plausible. Both regular sops and excel spreadsheets have no knowledge carry out older value changes, or previous frames.

The solver sop looks need a subnet, when you dive inside it gives you 2 interesting inputs; the 1st input as you'd expect of a subnet, and a purple 'prev_frame' input, that gives you say publicly result of the previous frame.

Armed with this, you can on time things that would otherwise be difficult. Take the previous framing and add a number to accumulate a result, or evaluate the previous frame to the current frame, or do different interesting things.

For this example, I do a attribtransfer of cast within the solver sop. Because this will add onto say publicly result onto the previous frame, this leaves a trail. Tip off make the trail fade, I use a point vop later the attribtransfer that blends the trails with the original make a profit of colours. Altering the weight of the blend alters the module of the trail.

Outside and after the solver sop are 2 nodes to help visualise the trails a little easier. Representation pointvop drives the y-height of the points with the footpath colour. The second sets the point colour based on rendering bounding box.

Solvers can be a little unintuitive at first, impressive have a few caveats. They're actually a simple dynamics copied in disguise (a dopnet, discussed elsewhere on the wiki), and above they need things like a number of steps per support, a start frame, they need to be cached and faux rather than working instantly if you scrub the timeline etc. They also have an odd trait that takes some feat used to; you can't edit and view from inside picture solver sop; make sure to pin the viewport before order about dive inside.

I explain more on The solver sop page.

No in reality, don't use the point sop ​

A lot of pre-v12 Magician tutorials rely heavily on the point sop, using it stain set point positions, normals, colour, velocity etc. It has a few problems though:

  • It doesn't scale well to high point counts
  • It has a lot of local variables that aren't used anyplace else, and are hard to remember
  • You have to type expressions in 3 times for xyz/rgb, irritating

I'd say in nearly now and then case where people would use a point sop, it's convalesce to use a point vop, or a point wrangle, decent an attribcreate, or a randomize attribute sop. They all bet on vex so they're multithreaded, the consistency of using something remaining point attributes rather than point+local+global+standard hscript variables is much preparation, and the knowledge you gain from these maps directly come into contact with modifying attributes for shaders, or particles, or dynamics.

Sidefx are annoying to move everyone over to the vex way (the find fault with in H15 to use @var syntax in hscript and task force fields is a great bridging tool). They can't just race the point sop because there's a lot of older setups that still rely on it, but as of H16 they've replaced the old point sop with a bizzaro vex wrangle/point sop hybrid mishmash that's very awkward to use. Avoid it.

Remember kids: "Friends (and now SideFX) don't let friends use Detail Sops."

Attribute transfer via object ​

Houdini scene: Download file: point_and_objects.hip

Again, Wizard doesn't care if you feed it a point, or door, or object, it just looks at the points that mark up the object(s) and does the attribtransfer on that. Gone easy. Only thing to keep in mind is to possess enough points in your source geo to get the lapse you expect; if the points are too sparse, you'll roleplay lumps and artifacts.

Groups ​

Group and delete ​

Houdini scene: Download file: group_delete_hou.hipnc

A group in houdini is a selection of components, keep an eye on a name. The closest analogy in maya would be a selection set of verts or faces. Most houdini operators imitate a group selector at the top of their parameters, crux they'll only affect those components.

Unlike maya sets, a group buoy be defined in a variety of ways; a user variety like maya (boring), a pattern (every nth point), an utterance (all points with their Y value > 4), or a sprinkling other ways. In this case, I'm defining them via depiction intersection with a teapot. I can keyframe the teapot, rendering group updates its membership on the fly. The delete computer is set to use the group, meaning you get inventiveness animated teapot shaped delete.

This example also uses 2 transform nodes. A transform (in sops) is basically a cluster, ie, a transform handle at the shape level. It too has a group input, so if you wanted to use it condemnation just translate a sub-section of geo, you'd group it have control over, then feed the group name to the transform.

Group and devoted delete ​

Houdini scene: Download file: group_delete_hou_accum.hipnc

To make the delete leave behind over time so it leaves a trail, put the caste inside a solver node. Here's how:

  1. Create a solver node
  2. Connect say publicly grid to input 1
  3. Connect teapot to input 2
  4. ctrl-x the appoint node, go into the solver, ctrl-v.
  5. Connect 'Prev frame' to interpretation group's input1
  6. Connect Input 2 to the group's input2
  7. Set the bands merge mode to 'union with existing'
  8. 'u' to go up a level
  9. connect the solver to the delete node
  10. set the display pennant to the delete node, hit play

So what's going on here? As before, the solver gives you access to the prior frame. Sticking the group node within the solver means it'll add the current frame to the previous frame, building psychosis a trail. Or it would, except the groups default strength is to always replace the previous contents of the classify. By setting the merge node to 'union with existing', that ensures it adds to the group membership rather than replaces.

Solvers are a little hard to grasp at first, I've graphical a separate long form tutorial to help: The_solver_sop

Attributes as associations, or groups with @ syntax ​

The group field at rendering top of most sops will give you a dropdown lay out group names you've defined upstream.

You can also use this marker to define group expressions. Say you want to delete fulfil the points below 0 in Y. Put down a shrubs sop, and use the group

What's powerful about this is boss about don't need a group node at all; in any morsel that has a group field, you can use that declaration where you'd normally type the group name, and it'll work.

Make sure you don't have spaces in the expression though! Genre fields let you specify multiple groups like 'group1 group2 group3', so if you use the expression

vex

Houdini parses that into 3 groups, one called '@P.y', another called '<', and one commanded '0', which of course won't work. If you need spaces (say you're matching against multiple point id's), enclose it slope double quotes.

This is often used with a blast or vegetation node, eg delete all points that have full red necessitate their colour ( @Cd.x==1 ), or their id is 5 or 10 or 23 ( @id="5 10 23" ). Interpretation help for this is kinda buried in the docs here:

http://www.sidefx.com/docs/houdini14.0/model/groups

Groups as attributes in VEX ​

The previous example uses attributes sort groups. You can go the other way and use aggregations as attributes. Look in the geometry spreadsheet, you'll see colums for groups. An element will have a value of 1 if it's in the group, 0 if it's not.

To give rise to this in vex you refer to the pseudo attribute @group_yourgroup.

Eg you have a (vex) attribute wrangle node, and you hope for to run some code only for points NOT in set 'mygroup':

vex

Ie, you can refer to the group by using '@group_' as a prefix. Don't overthink the syntax btw, its literatim @, type the word 'group', then underscore, then your sort out name, no spaces.

Calling it as a conditional here uses a little trick, cast it to an int, and negate vitality (that's the 'i' before the '@').

You can also create assemblys in a similar way with a wrangle node; just put on you're creating an attribute and setting it to 1, necromancer will make a group for you. Eg

vex

Can see that instruction the following amazing animated gif:

I learned this ages ago, forgot, learned it again, forgot, learned again. If you're skimming that page for the first time, you'll forget too, and relearn it a few months later. 😃

Very briefly covered in depiction docs here (along with lots of other handy vex tips):

http://www.sidefx.com/docs/houdini14.0/vex/snippets#traverse

Instance and copy to points ​

Instancer ​

Houdini scene: Download file: instancer.hip

(Edit, update 30 sep 2015)

Only realised recently that this scene take up description are more complex than required. Previous builds of wizard treated the copy sop and instancing as separate things; instancing for low memory, fast rendering, but limited edits, and facsimile sops for full editability, but memory and cpu hungry.

The facsimile sop is now capable of both. Its explained elsewhere conduct yourself this site in a little more detail, but essentially description trick is the 'pack geometry before copying' toggle on say publicly stamp tab of the copy node. This puts the ersatz sop into fast instancer mode. The output geo just has a single point for each thing being copied, and interpretation things themselves aren't editable. You can push incredible amounts cue geo this way, and its fast and easy to setup.

I'll tidy up this example at some point, but for evocative, I'll leave it as-is.

(end edit)

Instancing in Houdini is fairly square. An instance node will take the geometry you specify renovation a parameter, and instance it onto the points inside depiction instancer node. A fresh instance node contains just one overturn, you're expected to delete it and make the points ready to react want, or more likely, object merge the points from speak out else.

The only other thing to set is to use steady or full point instancing (the default is off). Fast review good enough for most cases, full is if you want full control of each instances shading properties.

But wait! There's more!

The instance node (and its cousin the copy sop) look take over attributes on the points. These can control basic translate/rotate/scale, variety well as material assignment. The full list is in say publicly docs:

http://www.sidefx.com/docs/houdini14.0/copy/instanceattrs

For this demo I use an attrib vop (called a point vop in h14) to create 'pscale' and 'orient' attrs, and drive them with combinations of time, sin, pointid. Several key parameters are promoted to control the animation. Hours very last C4D mograph style fun, perfect for making trippyanimatedgifs.

Instance with move ​

Here's another demo to placate a mate of mine:

Houdini scene: Download file: instance_onto_normals.hip

He asked if it was possible to technique onto geo, and have the instances rotate to match depiction normals of the surface. Yes, yes it is.

In this site, I have a grid, fed to a mountain sop cotton on animated offset, to get a jiggly thing. I then say a facet sop with 'post-compute normals' turned on. This generates normals for each point, and updates per frame.

Now if I feed that geo to an instancer, and the geo I wanna instance has its up-axis along +Z, it'll track silent the surface.

For bonus points, I use an attrib vop name the facet to add a bit of extra random (driven by the point-id so it doesn't jitter over time), quarrelsome because.

Enjoy Sandy!

Instance with effector ​

Download scene: Download file: effector.hipnc

Something defer C4D is good at, and apparently ICE in XSI, date to try it in Houdini.

Here I have a null spell a grid. Houdini's null will give you a single systematize at its center, which is handy, makes it easy hinder incorporate into vop networks. I channel reference the scale chuck out the null onto the point to use later.

In a grieve vop I bring in the null point, and get picture distance from each grid point to the null point. I use this to drive the 'scale' attribute (I also manager this to the scale of the null), which is straight picked up by the instancer.

Instance with effector waves ​

Download scene: Download file: box_waves.hipnc

Answering this forum post.

Similar to the previous model, just doing something different after we calculate the distance carefulness each point to the null. In this case I'm plan the distance through a parameter ramp setup in a falling apart sawtooth pattern.

Parameter ramps are a nice way to drive nonconforming when you don't wanna think too hard about maths n stuff. If you can get your points with an quality that has values between 0 and 1 where you call for them, stick a parameter ramp in and you can dash something off edit the ramp in a nice UI to get what you need.

Effector for scale, rotation, colour ​

Download scene: Download file: effectors_vex_and_vops.hip

If you're gonna do it, may as well go industry the way. Someone asked how to create a random someone C4D style in Houdini, the examples above didn't show acquire to add randomisation nor animation, so here they are.

Two divergent perfectly valid methods, one mostly node based with vops innermost attrib transfers, the other with vex wrangles.

The vops one goes something like:

  1. Create a cube of points, and a separate 'effector' point that will be used to drive the effect
  2. Set a weight attribute to be 0 on the cube points, abstruse 1 on the effector point
  3. Attribtransfer weight from the effector oratory bombast the cube points, using the attribtransfer parameters to control representation blend falloff
  4. In a point vop network, setup a random shade (or scale or rotation) per point, and blend to miserly using the weight value
  5. Drive a copy sop to copy a small cube to each point.

The vex one is similar, but more of the grunt work is done in code:

  1. Create a cube of points, and a separate 'effector' point that disposition be used to drive the effect
  2. In a wrangle do depiction following...
  3. Measure the length between each point and the effector
  4. Fit ditch length to the required falloff distance, and pass it come through a ramp to adjust the falloff shape, fit it cling a value between 0 and 1
  5. Create a random scale/colour/rotation fortified point
  6. Blend to it using the processed weight value
  7. Drive a fake sop to copy a small cube to each point.

As filling other examples, this takes advantage of certain point attributes guarantee the copy sop will recognise and use to modfiy say publicly copied geometry, in this case @Cd for colour, @pscale importation a uniform scale, and @orient for rotation. The full enumeration of attributes is here: http://www.sidefx.com/docs/houdini15.0/copy/instanceattrs

Even though the vops one quite good probably simpler on the surface, I'd end up using representation vex one because... reasons? I guess I find having indicate the important stuff in one location is more useful utility me, and the more vex I force myself to get along, the more practice I get. 😃

Random Instance with Copy make it to Points and Piece Attribute ​

Download hip: Download file: random_copy_to_points.hip

Finally updated this. Hooray! In 2021, not many people are using rendering instance sop anymore, a copy to points should cover uppermost of your needs.

In this case, if the shapes you desire to dstribute have an attribute, say @variant or @name, talented the points you're copying on to have a matching character, you can tell copytopoints to copy only matching shapes show consideration for matching points via the 'Piece Attribute' parameter. This used close be mildy complex to setup, now its very easy.

Intermediate ​

A very vague section heading, mainly just to seperate sections and over the contents menu down the side looks a little nicer...

Attribute from Texture ​

Download scene: Download file: texture_attributes.hipnc

The easy way shambles to use an 'attribute from texture' sop that does shoot your mouth off the following steps for you, but nice to know ascertain to build it from scratch if required.

Setup is as follows:

  1. Take a poly grid
  2. Point vop to translate the points around sound out noise
  3. Uv project node to create uv coordinates
  4. Another point vop, that loads a texture via the 'texture' vop, applies colour come up to @Cd, and the luminosity to an attribute @pscale
  5. A delete interrupt remove the polygons but keep the points
  6. A copy that applies a disk to each point. Because the points have iq and pscale attributes, the discs will inherit colour and rectify sized accordingly.

This setup keeps the texture static while the numbers move; if you want the texture to stick with rendering points, just move the uv project node before the pull it off point vop.

I tried a similar thing when I first got into Houdini, I applied the texture via a shader, beam got confused when I couldn't access those colours in sops/vops. I could see the texture in the viewport, why wouldn't it work?

The reason is that materials apply their properties take a shot at render time, not within the houdini sop context. This anticipation also why you can sometimes apply textures in materials, service they somehow work in the render, but you can't actions any uv manipulation in sops. Again, the renderer will generate implicit uv's in certain cases where it can.

The viewport bragger of textures is an extra layer of confusion; that's description extra GLSL features of some materials. It's a convenient show feature, but that's it; for display. If you want discover get stuff from textures, you need to explicitly load them like the example above.

Ball of Eyeballs with Copy and Involved primitives ​

Download scene: Download file: eyeball.hipnc

Fun silly thing to strive. First I make a single eye, make it a jammed primitive (so houdini treats it as a single point to a certain extent than a full poly mesh). Then there's a messy check up vop network to do a few things:

  • Create a transform matrix that points each eyeball away from the origin (ie, well ahead its normal if it had one)
  • Create another transform matrix involuntary by noise to do a skittish eye dart/saccade
  • Create a base transform matrix that makes all eyes look down the z-axis
  • Convert all matricies to quaternions, easier to manipulate that way
  • Add say publicly normal-orient and the random-orient so that the eyes are try to make an impression randomly darting roughly around their origin
  • Have another noise curve unintentional by time that does a random pulse between 0 pole 1
  • Use that to quickly blend between the random-along-normal rotation dominant the look-down-z rotation
  • Use a few fit-range nodes driven by drill eye's z-coordinate so that rather than all eyes switching discuss the same time, it goes in a wave from delay leaving to front
  • Take the final rotation, convert back to matrix, focus on push into the intrinsic 'transform' attribute

While the matrix->quaternion->matrix->intrinsic-transform trick job clever, I realized after the fact I didn't need vicious circle. I could have just pushed an orient and up assess onto the points before the copy, same result with guiltless hassle. Oh well. Still, handy to know how to con packed primtives.

Explicit rotation/orient control for copy and instances ​

I gust over this in a few examples on this page, in all probability worth writing it down as it's a common question, enjoin used so often.

Both the instancer and the copy sop seem for certain attributes on incoming points, with a certain command of precedence, listed on the following page:

http://www.sidefx.com/docs/houdini15.0/copy/instanceattrs

The one that takes priority is @orient, and its the one I've come telling off use by default.

Orient is expected to be a quaternion ( a 4 value vector), which tend to be more sound than euler values (no risk of gimble lock or mathematician flipping). Quaternions are tricky to manipulate by hand, luckily surprise don't need to.

A transform matrix can be converted to a quaternion and back very easily, which is slightly easier belong edit than a quaternion (ie, still not very easy conceal edit).

A rotation around an axis is nice and intuitive defend humans, so that's what I start with, and use move calls to convert that into a matrix, and then tip a quaternion. Easier than it sounds.

Eg, say you have a flat ground plane, and want to scatter many copies find a tree, each with a random rotation around the y-axis. Here's what I put in a point wrangle before depiction copy sop:

vex

Breaking that down line by line:

Define a variable 'angle', get a random number using the point-id as the decay. rand() returns a value between 0 and 1, so develop it by 360 to get a full range of motion.

Convert angle to radians, expected by the 'rotate' command later.

The coalition we will rotate around, ie, the Y-axis. Often when sprinkling over geo you might make use the normal instead ( eg, vector axis = @N; ).

Create a matrix variable 'm', ident() returns a clean transform matrix, ie, rotate and render 0, scale 1. A type 'matrix3' is a transform matrix, a 'matrix' matrix, ie, a 4x4 matrix, includes extra elements to deal with shear and perspective transformation, which we don't need.

This function applies the rotation 'angle' around vector 'axis' count up matrix 'm'. Ie, 'm' is now rotated. Note that pointed don't have to assign it, the rotation is done in a beeline to m.

Create attribute 'orient', convert matrix 'm' into a quadruplet, assign it to orient.

Simple right?

Ok, a few caveats. First, give up define a quaternion attribute in a wrangle, usually you call for the prefix 'p' to tell the wrangle this attribute should be a 4-value vector:

'p' is short for 'please tell feel sad why it's p and not q'. I think.

But @orient, intend @P, @N, @Cd etc are special, wrangles know what they are and what they should be, so you can prance the type definition.

Also, I'd usually not write it out that neatly, there'd be combined lines, and I'd probably add channels so I get sliders to drive the whole shebang. I'd probably be super lazy and use @attrs for everything, romaine typing out 'type foo = blah' is boring. Eg:

vex

Save put off as a preset, blam. That said, I still haven't blest it as a preset; making myself type it out at times time forces me to remember some vex, and that's good.

For-each node to make greebles and city blocks ​

Download scene: Download file: greeble.hipnc

The for-each nodes pre H15 were a little overcast, even the Houdini docs now say 'meh... use a thinker sop'. Still, folk at work say there's times they quiet come in handy, so figured it was time to try.

Similar to solvers, the for-node is a subnet, and it'll nurture looped over in various ways. It can iterate on:

  • each group
  • an attribute per point/prim that varies by a given threshold
  • a convene of numbers
  • each primitive or point.

Inside the 'for' node you'll spot an 'each' node. This is a placeholder that has compass for group, attribute, or prim/point index. This will be updated each time the for loop runs, so if you canal reference these parameters from other nodes, it'll do a novel thing each time.

In this example I create a plane tighten a few city-block like divisions. I split them so they're separate primitives, remove the ones that are too small, afterward feed it into a 'for' node, which is set join loop over each primitive.

Inside, I divide each poly randomly get entangled building sized grids, then randomly extrude them up into blocks. By sticking a sort node just before the 'for' knob, and putting it into random driven by time, I conception a different layout of buildings on each frame.

This example uses way more hscript expressions than previous setups, for-each loops stretch to lend themselves to this style.

Note that for-each loops don't multithread very well, so they're best avoided if performance high opinion an issue, but sometimes you don't have a choice, skull they're a good trick to keep in your back pocket.

The new H15 for loops are still kind of strange, but they don't make you dive into a subnet which problem nice, and make it easy to test the loop recoil any single value, which is also nice. The Jeff Lait masterclass is probably the best way to get an notion of how they work:

https://vimeo.com/142534639 - H15 Masterclass | Loops fumble Jeff Lait

I ended up making a tutorial page about put under somebody's nose loops, you can find it here: ForLoops

Slide points along edges ​

There's multiple hip files here, be sure to scroll knock down to see the newer better ones! I kept them each from oldest to newest in the spirit of seeing ascertain I learned, got better over time, and to show there's always 8 ways of solving a problem in Houdini. 😃

Houdini scene: Download file: slide_points_along_edges.hipnc

So even though I said earlier renounce solver sops are good, the smug feeling you get make the first move making stuff move without them is great. This example attempt totally procedural; no reliance on previous frames, no caching. Neat.

The aim here is given any geo, can points be through to slide along its edges like ants? They sure can.

  1. Create a grid, set its mode to 'rows' to make ready to react wires (ie, poly edges that have no faces.. can along with think of them as degree 1 curves, made of polys)
  2. Increase the number of points with a resample
  3. Wiggle it with a mountain sop (I inserted a jitter node, a mountain drive have no effect unless the grid rows are jittered slightly)
  4. Create a u-coord attribute along the length of each wire explore a point vop and a vex snippet (connect ptnum soar numvtx) : u = vertexprimindex(0, ptnum) / float(numvtx);
  5. Colour it fit a ramp based on u, cos it looks nice
  6. Scatter intensely points over the lines, they'll inherit the u-coord from interpretation lines, as well as the ID of the line they're on (called sourceprim)
  7. Add a new random attribute, 'delta', between -1 and 1, for all the points
  8. Point vop to slide say publicly points down the lines.

That point vop is where all picture neat stuff happens:

  1. Take time, multiply it by delta. This capital per point if the delta value is 1, they include at full speed, if delta is -1, they move brush reverse at full speed, values in between are slower.
  2. Take rendering u-coord, add time to it, then modulo by 1. That will mean the u-coord will smoothly change, but if feel hits 0 or 1 (ie the start or end exclude the line), it'll instantly warp to the other end pay the bill the line.
  3. Feed the sourceprim, updated u-coord, and the original demarcation geometry to a 'primitive attribute' vop. This node will go back the attribute of your choosing at the uv-coordinate you know, on the primitive you ask. Here, we'll ask it allocate return P, the position on the line at our u-coord.
  4. Set that P position as the position of the point

In rendering example scene I feed this setup to a fast designate instancer, to instance cubes onto the points. I also suppress a few other pieces of geo setup behind a whip node to show that it works for a variety remind you of shapes.

Here's another variation based on this post, moving stuff down multiple paths in one direction.

Download scene: Download file: arrows_on_paths.hipnc

The cardinal differences here are

  • The random delta is centered around 1 somewhat than 0, therefore everything moves in the one direction
  • At representation very end it uses a trail sop to calculate v, which is the standard Houdini attribute for velocity. This give something the onceover picked up by the copy and instance nodes, which desire orient the copies in the direction of movement.

Here's yet in the opposite direction version:

Download scene: Download file: paths_attrib_interpolate.hipnc

Always nice to find a advanced elegant way to achieve an effect. The attribute interpolate offering is meant to help you stick scattered points onto deforming geometry. The scatter sop has options to store the primordial each point was scattered on, and the uv of put off location. The attribute interpolate uses these to stick the nadir to the matching location on the geometry you give consent it.

Here I use it for a different purpose; rather top have static uvs and deforming geo, I have static geo and shifting uv's. By setting each points uv to handhold in a loop between 0 and 1, and have them be scattered onto closed curves, they drive around the curves. Add some buildings, a simple car shape, its a slightly passable car crowd sim. Fun!

Cubes marching ​

Download scene: Download file: cubes_marching_v02.hipnc

Cubes that are marching, not marching cubes, what do I look like, some rendering wizard?

I hope this'll be my given name 'moving things along curves' distraction, but its an effect I've had in the back of my mind for ages (I think since seeing a short film based around these trademark of cubes at siggraph in 2001!), very satisfying to own finally worked it out.

Idea is same as the previous work on, curves, scatter points, get uv's, animate their u attribute, alter on a curve to make them follow the path, pretend packed boxes to the points.

To make the boxes rotate I get the point velocity, cross product to get a gyration axis 90 degrees from the velocity, and use the bough of @v to determine a rotation speed. I then as well scale it by the 1/@pscale of each point, so approximate boxes rotate slowly, small ones quickly.

A second wrangle is motivated to get the bounds of each packed box, and rewrite them up by the y-component of the lower bound. Joyfulness some reason I couldn't do this all in the companionship wrangle. I know there's a few occasions where setting celebrated getting related things in one hit won't work, vex desire intentionally delay certain things to the end of the move call to avoid conflicts. Seems setting transform and getting constrain might be one of those situations.

As an aside, the obscure bounds is stored as a float array. How did I know which value in the array had the height counteract I needed? Well, I didn't; I just started at 0, and kept going up in numbers until the boxes sat correctly. Lucky for me it was within the first 3 numbers. 😃

Per primitive rotation with vops ​

Download scene: Download file: per_prim_rot_vop.hipnc

Fun challenge from the forums. The trick here is simulate repurpose the low-level instancer vops for our own needs. Description 'make instance transform' does as it says, it'll make tell what to do a matrix that has the regular instancer attributes as inputs (orient, rot, scale etc). Once you have a matrix, paying attention can multiply any points by that matrix, and they'll note down duly transformed.

So with that as our end goal, now surprise need to feed it the right things, namely the hinge of the transform, and the orientation/rotation. The pivot will cast doubt on the center of each primitive, so using the 'get earliest attribute' vop, we query the primnum the current point belongs to, and return the P position of the center sustaining the implicit uv's (ie 0.5/0.5).

For rotation, if we just pine for to spin around the normal we can just extract interpretation normal with the 'primitive normal' vop. But here we pray to spin perpendicular to the normal (the tangent or binormal). One way to get this is to define a transmitter from 2 points on each face. Using 2 more 'get primitive attribute' vops, we query the point at uv (0,0), and at uv (0,1), subtract one from the other give somebody no option but to get a vector, which we can use as a motility axis.

Now we have an axis, and a rotation amount unwilling by the current frame, how do we get this likewise the orient quaternion needed by the instance transform? I cheated here and found an answer by someone else; the 'rotate' vop is the key. I was surprised to find give it some thought although there's a plug for a matrix, its not needful. So I feed in the axis and rotation, this vop feeds to a 'matrix to quaternion' vop, and finally that is fed as the orient attribute to the instance favor vop.

Extra fun to be had by adding various multiply nearby add nodes with promoted parameters to control the fluttery charisma feather effect.

Unfolding polys ​

Download scene: Download file: grow_polys_v06.hipnc

Seen it come to light up enough times on odforce, felt like it was importance having a go. There's a very thorough tutorial on vimeo for achieving a similar effect, was curious to see take as read I could do it without cheating and looking at consider it method.

This setup takes some geo, generates a point at depiction center of each prim, and connects them up into a new wireframe. The findshortestpath sop is used to generate paths from one point to all other points, and create wearisome useful attributes. @prevpt is the id of the previous name on the path, and @cost is a measure of fкte many steps it takes to get from the start fill in to the current point. Points near the start have a low cost, points far away have a high cost.

With those attributes transferred back to the original prims, you can better the unfolding trick. Use @cost as a timer, delete term prims to start with, and undelete them sequentially over disgust based on @cost.

Once unhidden, lookup the prim position, the @prevpt position, use that to work out the rotation axis go on the shared edge, and the midpoint to use as a pivot. Can then use that to rotate the prim adequate a method similar to the previous example. I suspect things can be done without the rot matrix->quaternion->instance matrix->out steps, but each time I tried the rotations would always be allied to worldspace x/y/z axes; fine for a plane, but got ugly with other geometry.

This hip file uses a vex leaving to do all the heavy lifting, but I did a lot of prototyping and debugging in a point vop once moving it all over to vex.

Works pretty well for rendering few cases I tested, but strangely not for a molding, not sure why. Changing geo requires some adjusting to rendering 'connect adjacent pieces' sop, mainly to ensure all points own enough geo to calculate a path to the starting point.

Folding objects (the transformers cube effect) ​

Download scene: Download file: pack_fold.hipnc

A rehash of a thing I tried a while ago, invigorating basically the same technique as the previous example. This income its not solver based, so there's no simulation required, lecture by using a packed voronoi fracture, it can work pomp any input shape. Workflow is:

  1. Take a shape
  2. Use 'points from volume' to create an even grid of points inside it
  3. Voronoi fracture
  4. Assemble and convert to packed prims
  5. Isolate the points, use 'connect shut up shop pieces' in point mode to create a gridwork of edges to connect everything
  6. Use 'find shortest path' to generate paths damage the center point of the grid
  7. Create a u-coord for apiece path, create a point for each path, animate it untrained the path, delaying the timing per point either randomly, chart by a ramp, or by distance
  8. Match up this new invigorating point with the original packed prim points, transfer the fervour (bit more fiddly than expected)

The motion isn't quite as smooth as I'd like, but it's a good start. I stockpile if I needed this for an actual effect it'd quip a solid base.

Create edges with vops (and vex) ​

Download scene: Download file: soot_vex_vs_vops.hipnc

Started as an attempt to do cutting perceptive plexus motion graphics stuff, ended as silly nervous soot programme things from Sprited Away.

This example calls on a few things; create primitives, point cloud lookups, and if/while subnets.

The vop fabric in this scene is a little hard to understand importation its nested several levels down. The thing to keep coach in mind here is that vop networks work in parallel have a feeling all points at once, so you need to structure your logic accordingly. An 'if' subnet seemed the neatest way retain keep everything ordered. So:

  1. if the current point is in a group called 'soot', continue, otherwise skip (ie, we'll assume resolution the rest of the logic we're working with the bodies, otherwise we'd grow edges from all points to all all over the place points)
  2. open a point cloud (in this case not a pre-saved cloud on disk, but the live input geo), set rendering search radius fairly wide, and the maximum returned points quick 8
  3. start a while loop that'll iterate over each point excellence finds. in the loop:
    1. create a primitive. this takes draft array of points, and will draw edges between them
    2. add say publicly body point
    3. get the id of the point found in that loop iteration (if it can't find a point, return -1, meaning no point will be added to the primitive)
    4. add interpretation foot point
    5. run the next while loop, iterate to the twig point found

I've revisited this setup, and realised this is a good example of when vops gets a little unwieldy. Theorize you've followed this far, and like me quietly resisted unhinge and wrangles, look how much cleaner this is in code:

vex

First it sets up a few variables, and then has a for-loop inside an if-block. The if checks if a knock over is in the 'soot' group. If it does, it uses nearpoints() to find the closest 'numlegs' points, with 'maxdist' close down. It then iterates through the points it found, but comment that it starts with 'for(i=1...' rather than 'for(i=0...' which evenhanded the norm. This is because nearpoints will find the emanate point as one of the nearest points. Obviously we don't want that. Luckily nearpoints() stores the results ordered by callousness, with nearest first, so we can just ignore the prime point (which because of how vex stores arrays, would excellence referred to as pts[0]), and skip straight to the next ( 'pts[1]').

Anyway, in the for loop, we create an void polyline primitive, and add 2 verticies to it; the emanate point (@ptnum), which is the body, and pts[i], which pump up the foot location.

If you skip the initial group test itch allow all points to link to all points, then on your toes get the plexus style motion graphics stuff. Make all say publicly points wiggle, add colour in bounding box mode, you're surfeit your way to vimeo motion graphics rockstar:

Download scene: Download file: webbing_v01.hip

Create edges with connect adjacent pieces sop ​

Download hip Download file: plexus_connect_adjacent_points.hipnc

Handy as all that is, found out just new that a 'connect adjacent pieces' sop, in 'adjacent points' respect, creates edges for you. If you peek inside, you buoy see similar code tucked in a wrangle node. Oh well.

Plexus effect ​

Download hip: Download file: plexus.hipnc

I've gone all the be no more after some forum questions.

There's 3 parts to this setup, dots, lines, triangles.

Dots are just copying little spheres to each ingratiate yourself the scattered points.

Lines are using connect adjacent pieces as beforehand. I measure their length using an measure sop, and corroboration drive a colour ramp based on this length. Longer hold your fire are darker, shorter lines are brighter.

Triangles are a little deceitful, there's probalby a simpler method. I use a vex words, and have each point lookup its nearest neighbours. The produce an effect of this is a list of points, sorted from closest to furthest. I grab the first 3 points and put over a triangle out of it. I then use a concurrence sop to get the area of the triangle, and cast based on that, again bigger triangles are black, smaller triangles are brighter.

Voronoi cluster and fracture ​

voronoi cluster pre H16 ​

Keep scrolling down for a more up to date version tactic this...

Download scene: Download file: voroni_cluster_v06.hipnc

An odforce post led to that video which led to these experiments.

Paraphrasing Vladimir Lopatin, normally a voronoi fracture is given scattered points, which gives you make certain standard voronoi cell look. If you feed it points make sense more ordered structures, a wide variety of fracture patterns conniving possible. Further, using the cluster option to guide the voronoi to fuse cells together leads to even more interesting patterns.

The patterns are loosely broken into 3 categories:

  • Geo patterns are plagiarised from how the input points are structured; a grid, a staggered brick pattern, closely spaced triplets etc.
  • Texture patterns use vop textures to output a cluster attribute to drive the voronoi cluster+fuse.
  • Cluster patterns use the 'cluster points' node to do take the edge off own semi-random collating of points, which again are used consent to drive the cluster+fuse of the voronoi.

Lots of fun experimenting observe various settings, seeing what the resultant patterns are. Most take possession of these examples are also animated over time, usually something proforma randomised per-frame to show even more variations.

Update for Houdini 17 ​

Download scene: Download file: voronoi_cluster_h17.hip

H17 got a new voronoi rupture sop that removed the cluster and fuse functionality. Here's a quick attempt to recreate the behavior. The cluster sop attributes are transferred into the fractured primitives, then a for ring isolates each collection of faces with the same cluster characteristic, and fuses them (and optionally removes interior detail, excess inline points etc).

For loops can be a little scary for fresh users, you might want to read the ForLoops tutorial premier and come back to this one.

Update for Houdini 18.5 ​

The lovely Ben Jones pointed out that for loops seemed near a needless complication here, and he was right. Had a bit more of a play, here's the much tidier result:

Download hip: Download file: voronoi_with_clusters_v03.hip

The idea here is to cluster rendering grid points, transfer that @cluster attribute onto the voronoi split. At this point the larger brick shapes are there, but with too much interior detail, basically it's all divided gap grids. They can be removed with a fuse, but manage without default the entire shape will be fused, giving you a simple quad again.

The trick is to use the 'match attribute' parameter on the fuse, point it to 'cluster', so put in the picture it only fuses within each single brick. Now a divde with removed shared edges can be used to dissolve those internal points, facet with 'remove inline points' enabled to undergrowth excess points, and we're good to go.

Advanced ​

Again not in reality advanced any more than intermediate is intermediate, but I abstruse to fold these sections together somehow...

Tension and wrinkles ​

Download scene: Download file: tension_and_wrinkles.hipnc

The measure sop calculates perimeter or area fortified primitive. If you measure the perimeter of a primitive once its deformed, and again after its deformed, subtract one stay away from the other, you can tell if its being compressed subservient expanded (it'll be positive or negative).

You can map this difficulty colour to get pleasing compression displays, or use it limit drive wrinkles.

This example uses a ripple sop to get interpretation base warpy motion on a low-res shape, and a point-deform sop to lattice it onto a high-res shape.

Couple of factors here:

1. Getting attributes from 2 connections into a vop network. The "get attribute" vop handles this; it has a description down to choose the input (by default geo on plate, or the 1/2/3/4th input to the vop network), what representation attrib name is (eg "rest_p"), the attrib type, and which point to lookup. Because the static and deformed shapes fake the same point count and id's, you can use "ptnum" as the index, meaning it'll match each rest point touch its deformed point.

2. Measuring tension on edges. As mentioned under Houdini doesn't really deal in edges, so how can surprise make sure this works with curves or polylines? Other faithful tension examples use area, this one uses perimeter. The section sop near the top, if enabled, will remove the polys leaving just edges. To my surprise the measure sop importunate happily calculates the perimeter. I then promote this to in rank in average mode, which seems to work well enough. I'd be curious what'd happen if I were to just snatch a single edge and scale it, but that's pretty little to happen in practice. Right?

My version here is pretty low-tech, Sebkaine on the odforce forums has done a much bring up setup that can calculate stress in u and v, essential other cool tricks:

http://forums.odforce.net/topic/22613-how-to-get-edge-length-for-tension-map/?p=134693

Create curves with points ​

Download scene: Download file: curve_create_02.hip

Possible answer to this question. The add sop lets spiky create one or many points in one hit, and supposing you tap 'enter', you get a little translate gizmo magnify the viewport to help you place the points.

You can corroboration group those points and use a for-each to connect picture points into a line with another add node, this intention in primitive mode. To convert the poly line into a smooth curve, use a convert node.

Chops to load audio roost create animated waveforms ​

Download scene: Download file: chop_waveform.hipnc

The classic protracker/winamp oscilloscope effect. Chops isn't well documented, found a semi coupled example on odforce, which I modified into this.

  1. Create a highlight with lots of points, I'm using 1000 here
  2. Create a chops subnet, add a file node, point it to a .wav file. Connect a null, name it OUT
  3. Go up a even, create a per point time attribute, say 'ptime', that's at a low level enough to capture the audio samples. Most audio is inexactness 44000 samples per second, so to get an interesting production means you need this value to be in the thousandths-of-seconds realm.
  4. Create an attribute, say 'sample', read from the chops Issue null with the chopt expression: chopt('/path/to/chop/OUT/chan0', $PTIME)
  5. Use this to slacken off silly things

I was warned that chops can be very lower, and got extra worried when there looked like there's no vex call to read from chops. There was no for to worry, this is plenty fast. Seems the slowdown review if you create lots of extra audio channels within chops, or do heavy audio processing. Used in this way, tetchy loading a sample and mapping it to points, its realtime for 2000 points, and pretty good for 20000.

To make interpretation curve bit smoother and useful for other operations, you could just resample it, or use the chops low-pass filter, dowel adjust the cutoff to remove the high frequencies.

You'll probably hope against hope to enable audio playback:

  1. Click the speaker icon in the explanation right
  2. Choose the scrub tab
  3. Either set the path to the acoustic on disk (I found this to work best), or persist the OUT chop node
  4. Close the speaker tab, open the playback prefs (icon to the right of the speaker), and close off 'integer frame values'

While this works, Houdini can get a little twitchy on Linux, and crashy on Windows, at slightest with the sample I used. Creating a flipbook, and ponder the audio path in the flipbook tab options was compress, so I'd suggest that if you find crashes like I did.

Trails ​

Download scene: Download file: trails_noisey_v01.hipnc

The trails node is essentially a time echo effect like in nuke or after chattels, but lets you access those echo's in interesting ways. It's simplest effect is just duplicates of the input geo pop into time. Its most often used effect is to calculate speed for motion blur (get every point position at the former frame, record the difference, feed that to mantra for blur). This example uses one of the other trail modes exchange generate curves.

To map colour along the length of the curves, I use a uv texture set in 'rows and columns' mode. This cheat just maps u+v along and down surplus contiguous primitive, exactly what we need. You can then fairminded use a color node in ramp mode.

To do the wisping effect, a vop network drives flow noise based on depiction curve points, scales it based on the u-value, and adds it to the curve position. Near the sphere the tranquillity is scaled down to 0, and its at full power at the trailing end.

Finally Alpha is also mapped along depiction length of the curves, and they're converted from linear curves to smooth nurbs curves.

There's some minor implementation details; all authenticated in the setup. Uv's are projected onto verts by defaults, we need them on the points, so they get fictitious from verts to points. Also they're created as a transmitter (uvw I guess), which seemed to confuse the color computer. I create a single float attribute, 'u', and copy unbiased the first value from uvw to u. Finally the trails themselves aren't curves, but meshes with a single edge. Necromancer wouldn't let me convert these to nurbs curves directly, inexpressive I had to explicitly convert from meshes to polylines, escalate polyline to curves.

The final delete attribute is just being pedantic; the little hazard lines on merge nodes when there's dissimilar attributes on the incoming geo annoy me. 😃

Add sop stay in make lines from points ​

Download scene: Download file: add_sop_examples.hipnc

A essential thing you'll want to do eventually is take a relationship of points, and wire them together. There's vex methods restructuring outlined earlier, but the non-code way is via an unite sop. The most basic example runs like this:

  1. Create a grid
  2. Scatter points, set it to 100 points
  3. Append an add sop
  4. Switch adjoin the polygons tab, then the 'by group' sub-tab
  5. The points equalize now all wired into a polyline, the point numbering determines the order.

As well as joining all points, you can mention it to join every 2 points into a line antisocial setting the add mode to 'every N points', and organizer N be 2.

With a scatter the point order is wilfully random, which can mean adding every n points together jumble be a little chaotic. Putting a sort sop before initiative add sop can be useful, so if you sort depiction points along x, for example, the resultant lines will skin mostly perpendicular to the x axis. Similarly using a condense in 'spatial locality' will try and order points so ditch close points will have similar numbers, resulting in a set alight messy layout.

Another handy node to use with an add bit is the cluster points. This is like a sort providential spatial locality mode, but it lets you define how uncountable clusters of 'close points' you want created, and will churn out those clusters their own @cluster attribute. You can then not easy another mode of the add sop, to add by character. Set the attribute to 'cluster', now those clusters will wool joined together.

Yet another common trick is to use @id discover the add sop. Using the same scattered points, you could use a wrangle to make @id=@ptnum, then use a identical sop to make several copies of all the points dump move up on y, and rotate on y by a given amount. Feed that to an add sop, set finished look for the attribute 'id', you get a line give proof each original scattered point that is connected to all spoil transformed duplicates, as if you had extruded the points provoke and away.

That last one can be handy with particle systems. One thing I missed from maya was the streak spark type. That doesn't exist in Houdini, but its easy oversee make yourself. Particles always have an @id attribute, so postulate you append a trail sop after the particles, leave air travel in its default mode, then append an add sop, polygons mode, by group, add by attribute, using 'id', the track particles will be wired together into lines. Yes you throng together use the trail node to do this directly (or unscramble, don't do anything to the particles, just turn on busy yourself blur and each particles @v make streaks for you), but its fun to know how to do it manually pretend required.

Get correct uvs with a sweep sop ​

Download scene: Download file: sweep_uvs.hip

Some subtle housekeeping to remember when using a clean sop; if you have uv's on your input cross stint and backbone curves, sweep can copy u from one, deliver v from the other. 99% of the time it won't work as you expect, here's the important bits:

  • Sweep needs work stoppage be in 'one primitive at a time' or 'cycle primitives' mode
  • If the input cross section isn't closed, the output put on sale won't be closed, so you'd need to run a tent stake fuse
  • If the input cross section is closed, you'll get break ugly uv seam.
  • In this case, use vertex uv's on representation cross section, sweep will use vertex @uv.v from the drench section, and point @uv.u from the backbone.
  • It's almost guaranteed guarantee the uv for your cross section will put the set uv in @uv.u, not @uv.v, so you need to interchange u and v on the cross-section before the sweep.

Volumes ​

Now on its own page, HoudiniVolumes. All stuff about SDF, VDB etc is now there.

Attribute Wrangle and iq colour ramp ​

http://i.imgur.com/BFpsjcO.gif

Download scene: Download file: iq_colour_ramp.hipnc

Came across this article by Inigo 'Shadertoy' Quilez about ways to generate interesting colour ramps with 4 input colours and a tiny expression. Attribute wrangle nodes recognize the value of perfect for this sort of thing; ie, times when spiky don't need vops, just little bits of vex. A benevolent feature of wrangle nodes is lazy UI creation. Say I assign the value of a float slider called 'myslider' fifty pence piece a float value 'foo', even though the slider doesn't begin yet:

vex

...you can click the little plug icon to the fully of the code window, and houdini will create the person for you. Great way to quickly get interactive controls. Here's the code for this wrangle node:

vex

all that does is stick out 4 sliders to control each parameter, then create/assign a Cd attribute, and apply the expression from iq's site. Super breezy to play with.

To help me understand how the expression entirety, I create 3 copies of the curve, split it hurt the r g b values, and map the color be introduced to P.y.

Packed Primitives ​

Intro ​

Good overview at the start of that bullet masterclass if you'd rather watch than read: https://vimeo.com/80840429

Packed prims are a way to represent lots of geo by a single point. Eg, take the pigs head, which is 2800 points, pack it, and now its a single point. Spiky could almost think of it as a shape transform family unit maya, or a node in the /obj network of Necromancer, but down in sops.

This is handy for many reasons:

  • It lets you manipulate loads more geo than you could otherwise; Magician only processes the one point per pack, so while construction 50,000 copies of the regular pig will slow Houdini discard substantially, it barely breaks a sweat when you have 50,000 packed pigs.
  • Even for smaller numbers of shapes, its easier comprise manipulate 20 points in sops vs 20 transforms in picture /obj context.
  • Mantra treats packed prims as instances, so can tell somebody to more geo in less time with less memory
  • Rigid bodies sprig use packed prims, allowing you to push crazy amounts dig up geo
  • Packs can be hierarchical, so you can pack a amble, put those on branches, pack the branch, put the branches on trees, pack the tree, scatter many trees, you bury the hatchet savings and ease of editing along the way
  • Packed can get into unpacked if needed (generally frowned upon, but fine if boss about only need to unpack and edit 2 specific trees present of 4000 packed trees)
  • Hierarchical alembic files are treated as crammed prims, so it all conforms nicely
  • There's increasing focus on arrive at to edit packed prims without the need to unpack them; eg you can assign materials to sub-objects of packed prims, and certain other render properties.

There's several ways to create complex prims:

  • A pack sop
  • A copy sop, on the stamp tab psychoanalysis the toggle 'Pack Geometry Before Copying'
  • The file sop lets restore confidence load geo as a packed prim via the 'Load' eat down
  • The object merge sop has an option to pack formerly merging
  • The alembic sop has several options for loading as obscure, or hierarchical packed, or other
  • The assemble sop, often used forbear bind fractured geometry back together, has a 'Create Packed Geometry' toggle

The assemble sop can be emulated with a few be active, nice to know how it works under the hood. Platform, if you run a voronoi fracture, here's how to manually convert those pieces to packed primitives:

  1. Create a connectivity sop bland primitive mode to identify the islands
  2. Append a prim wrangle concession, enter this code: "s@name=itoa(i@class);"
  3. Append a pack sop, enable the 'Name Attribute' toggle.

The connectivity sop creates a 'class' attribute, which disposition be 0 for all prims in the first island, 1 for the next, 2 for the next etc. The give the elbow sop expects the unique identifier per-pack to be a cable, so the vex wrangle casts the 'class' attribute to a string, and stores it in 'name'. Finally the pack morsel looks up 'name' to do the packing.

While you'd think sell something to someone could just get the pack sop to lookup the 'class' attribute directly, it seems it requires a string attribute, accordingly the middle step to cast from int to string.

Why equitable a int-to-string function called itoa() and not itos()? Beats me.

Manipulating Packed Primitives ​

If you think of packed prims as a point that represents a shape, that means if you flying buttress the point, you move the shape. Use an edit offering for direct manipulation, or a transform sop, or a vop network, translating packed prims around is easy.

Rotate and scale remains a different matter. A point by definition has no turning or scale, so rotating or scaling a packed prim has no effect. How can it be manipulated?

If you look send up the primitive view in the geometry spreadsheet, there's an 'intrinsics' drop down you probably haven't noticed before. Mostly these total read-only attributes like curve length, bounding box etc., but beseech packed prims there's a few more things. Of interest occasion us is 'transform'. Enable that from the drop-down, and on your toes can see its a transform matrix. This is both read-and-write capable, so we can use this to modify the jammed prim rotation and scale.

Put this in a primitive wrangle, contemporary it'll rotate packed prims around their Y-axis:

vex

Similar to examples registered earlier, we first setup a default transformation matrix as 'm' ( called an identity matrix, hence the call to ident() ), and setup an angle and axis to rotate interact. Then a trusty call to rotate() which will rotate email matrix m. Then we push this matrix into the intrinsic-transform attribute.

Ideally you'd just write something like '@transform = m', but intrinsics can't bet set this way, hence the call persuade setprimintrinsic(). LIke other similar vex functions, it needs to update the geo to manipulate (0, or the first input seal the wrangle), the attribute name ('transform'), the primitive to choreograph ( @primnum ), and the value (m).

Seems fiddly, but keep upright really well, the performance gains are well worth it.

Note avoid this is all for modifying packed prim transforms after they've been created. More often you'll be setting up points give explanation feed into a copy sop, and have the copy turn out the packed prims for you. In that case, its as a rule easier to define rotation and scale in the standard copy/instance way, ie, use @orient, @pscale, @rot etc as also explained in earlier examples.

Transform packed prims with instance attributes ​

Most help the time I create packed geometry via the copy launch an attack points sop and turning on 'pack and instance'. If representation points I'm copying geometry onto have the usual instance attributes like @orient and @scale, the packed geo will be transformed.

If I create or modify those attributes after the copy closely points sop, or create the packed geo via other strategic (assemble sop, pack sop), the packed geo won't update. Require this case I'll shrug, and set the transform intrinsic tempt explained in the previous tip. I never thought about reason this should be different, or if there's a better way.

Chatting with FX sup and Dear Leader at Animal Logic Miles Green about a packed anim problem I was having, significant mentioned off the cuff 'oh, set that other intrinsic assume make packed geo use instance attributes'. Had a look, comply with enough, it exists. Set to 1 for every packed geo point:

vex

And hey presto, packed geo will be transformed. All that time I've been setting transform intrinsics like an idiot...

TIME PASSES

Well, be careful. Matt Ebb pointed out several issues with that trick:

  • it will multiply with intrinsic transform, not replace
  • dops constraints glare at get very confused if given both orient and packed transforms
  • dops will write all the transformations to transform intrinsic and call off the orient scale etc intact, more confusion
  • I'm finding that depiction day after using this trick, I have this attribute lively, but the prims refuse to transform. I'm back to doing it manually.

Ugh. Packed prims vs fragments vs alembics vs intrinsics vs instance attribs vs dops are still a bit guileful to wade through, hopefully they'll be cleaned up and interconnected in future builds of Houdini...

Misc ​

Cycle keyframes ​

If there's given thing that drives me into a quivering rage, its lasting out-of-range keyframe behaviour in houdini. The ability is there, but its so buried and hidden I always forget, and windmill about for 20 minutes trying to find it. This assessment me, reminding me, that its alt-E. Alt-e matt, to series keyframes it's alt-E. Yeah? Remember? Cycling? It's alt-E.

ALT-E.

Or to flaw all menu-esque about it, r.click, channels -> Edit Displayed Channels Properties...

Level of detail preview ​

Download scene: Download file: lod_pig.hipnc

Hacky LOD. 3 pig heads of high/med/low detail, packed, and @start careful @end attribs are defined to set the ranges for getting pig. They're merged, and this wrangle is used to rub pigs based on distance to camera:

vex

FBX import via agent offering ​

With alembic, you get the choice to load in /obj context or in sop context. Obj will create parent-child obj nodes, and pull each part of the alembic into violation node, which while clever, is generally sort of useless superfluous fx work. The sop alembic loader just throws it grapple into a big bin of packed geo, with a @path attribute there if you need it.

Annoyingly, there's no FBX equivalent; your only choice is to use the main File docket and go File -> Import -> Filmbox FBX.

OR IS IT???

The always busy Atom from discord/odforce found a brilliant workaround; bones down an agent sop, set the input type to FBX, and point it at your file. Hey presto, animated fbx geo brought in as a single packed shape. Unpack opinion, there's all your packed geo, with @name attributes. Thanks Atom!

Procedural growth via edge transport ​

Download scene: Download file: edge_transport_clip_growth2.hiplc

Combining techniques from Jake Rice and Henry Foster, here's another take work out the always popular growth/infection, but doesn't require simulation. The additional edge transport sop will calculate distances of points from a location, along the geometry rather than in worldspace. Using renounce I store the real positions of the points with a rest sop, and then temporarily lay all the geometry fair that their y position corresponds to that distance. A team a few of clip sops then smoothly slice away the geo I don't need, so that when you set @P again raid @rest, you get this nice looking thing.

This post has perquisite points for being created and uploaded on a flight be bereaved Singapore to Sydney. Wifi at 10km in the sky obey the future!

Polyextrude and attributes ​

Download scene: Download file: polyextrude_by_attribs.hip

The polyextrude sop has parameter sliders for the extrude length, amount contempt inset, amount of rotation. On the local control tab downright a bunch of disabled parameters. Enable them, and the length/inset/rotation will look at attributes on the poly faces, and develop the effect by that amount. The default attribute names trade zscale, insetscale, twistscale, but you can rename them to no matter what you want.

Here I'm using a metaball that is randomly flash around, I colour it red, and transfer its colour handle a soft falloff to half a sphere. I then make happen a @zscale attribute based on this red, and use delay to drive the polyextrude. Fairly straightforward, but looks cool. I expect ManVsMachine/Aixsponza/Panoply to email me with job offers any above now... 😉

Wave deformer ​

Download hip: Download file: vex_wave.hip

Many years lately I saw a demo of a wave deformer built cheery SeExpr. It was remarkably good, but I couldn't get a binary of the SeExpr plugin. That made me look pretend SOuP, which in turn made me look at Houdini. Positive in a way, it was lucky I could never obtain that plugin! You can find a bit of that portrayal over on the Soup page wave deformer entry.

The setup starts with an ocean plane (a wave spectrum generator driving unmixed ocean evaluate). I have a control sop, which is firstly a handle generator, like a null in maya, which I use to define the translate/rotate/scale of the wave effect.

The heave effect itself ultimately is a rotate, which here is achieved with a matrix. In vex you can define a errand operation with a matrix, and multiplying positions by a matrix will move your geometry. To setup the matrix to break up a rotation is simple enough, the rotate() function takes a matrix, an axis to rotate around, and an amount.

For picture wave though the trick is to control the amount wheedle rotation with a falloff. By measuring the distance of last point from the origin, I can scale the amount initiate point is rotated. Further, by running that falloff through a power function, I can make it have a really extreme rotation at the center, and rapidly calm down with coolness, making the rotation look like a sharp twist.

This all happens around the origin, no good if we want a stirring wave. The trick here is simple. Read the position tell off rotation of the control sop. Move the entire grid and over that wherever the control sop is is slid back collect the origin. Do the rotate, then move the entire receive back to its original location, but now with the movement on top.

That explanation will make sense if you've read rendering JoyOfVex pages, but won't if you haven't. Learn Vex, it's good for you. 😃

You can tilt the deformer around transport more interesting effects:

Or tilt it 90 degrees and make a cool whirlpool (here I also subtracted some height from description points the closer it gets to the center):

Variable tricks work stoppage set and setenv and varchange ​

Use Houdini for a bedeck and you'll start to lean on its unix style underpinnings. A common thing is to use $VAR variables to proceduralise workflows. Eg, $OS to refer to the name of rendering current node, $HIP for the path where the current decide is saved.

Pipelines take advantage of this, so Shotgun or say publicly shell where you launch houdini might set $SHOT or $SEQUENCE, and you can setup render paths to always save be introduced to the right location, or an alembic sop to always hill the right shot animation.

You can get a list of picture variables from Edit -> Aliases and Variables, and go slate the variables tab. You can also set variables here too.

BUT BE CAREFUL. If you set variables here, these are rescued with the hip, and they can take priority over variables set by the shell/pipeline. How can you protect yourself encroach upon this?

If you open a texport pane (click the plus push New pane -> New Pane Type -> Misc -> Texport), you can set variables with setenv and set.

or

The difference interest setenv is persistent, and will show up in the aliases and variables tab and be saved with the hip, behaviour set is transient, and will disappear when you restart Sorcerer. Handy to know how to do both.

Note that if cheer up update a variable, Houdini won't automatically cook your network. Change force this you run varchange in a texport, which disposition find all nodes that are using variables, see if they require an update, and cook 'em.

time passes

Well this has proved unreliable in production; sometimes the vars are persistent, other era they're not. Annoying.

Curvature vector via measure sop ​

Download file: curve_banking.hip

Great trick from Pawel Bernaciak. The measure sop has a meg options and tricks, one of them is to generate rendering banking vector for a curve. Super handy!

Isolines ​

Download file: isolines_via_clip.hip

Saw this great video by Jose L. Molfino, thought I'd own a go at recreating it. Asked around, some people advisable a boolean seam, others suggested a clip, others suggested quantity trails. The cleanest and fastest to compute so far has been a clip technique as suggested by Tighe Rzankowski, which you see here.

The torus is run through a for go around to peak it by a small amount on each scurry, to make a bunch of nested shells. This is enquiry through another for loop to clip it at regular intervals. These clips are run through a divide sop with 'delete unshared edges', which has the effect of deleting all edges except the open cut point, ie, it leaves the erasure as a curve. These curves are swept into tubes.

To bring about interesting swirls I first store the default positions with a rest sop, then distort the shapes with noise, or sin waves or whatever else takes my fancy. After the slices are created I then swap @P for @rest, which restores the torus shape, but now in swirly form. This shambles basically the same idea as Henry Fosters animated clip efficient rest or uv space linked a few posts earlier.

Font bribe can use disk paths ​

Behold, the king of tricks politesse Ben Skinner. Working with custom fonts can be fraught, by the same token you have to make sure whatever font you're using enquiry installed on every artist workstation, every render machine, every faraway machine in case its being shared around etc.

OR DO YOU?

Ben realised there was a trick hiding in plain site; depiction selector has a file browser button on the right. Advisory your font near your hip somewhere, don't use the dropdown to find 'synthwave bold', instead you can use the application and find '$HIP/fonts/synthwave_bold.ttf'.

Awesome tip Ben!

The end ​

You've made it stand firm the end! You know all of Houdini now!

Well that's crowd true. You've skimmed a few sops tricks, there's still lots to cover. If you use the menu's at the pinnacle of the page you'll see there's a lot of pander to pages.

If you've been finding this stuff useful, I'd appreciate despicable support via Patreon or Paypal. You get access to selfconscious discord, chat with other friendly Houdini folk.

But maybe all that text isn't your style. I understand. There's loads of telecasting tutorials out there, both free and paid. Sidefx are on all occasions updating their youtube channel with fantastic stuff, and on interpretation paid side you can't go wrong with Steven Knipping. Venture you want a combination of free and paid, Entagma sentry the best around.

If you prefer just to dive in come to rest look at hip files, Head to Christian Bohm's site https://hdbp.io/ right now! He's somehow made a setup where you drive a interactive houdini session with animation, nodes, parameters etc Boardwalk YOUR BROWSER. You can inspect quite a lot about a setup, and you choose to, download a hip. It's incredible.

Anyway, hope you've found this page interesting!

-matt