Search
  • Josh

SPIRALIZE CURVE USING ROTATION MATRIX IN VEX


So last night I was in the process of developing a braid otl in houdini16.5 because I'm working on a character who in fact has braids. A hurdle that I had to overcome was how to make a curve spiral around its direction. To do this on a straight vertical curve is trivial. you would simply set the position to be cos(degree*@ptnum),@ptnum,sin(degree*@ptnum). This however doesn't translate to a bent curve at all. The coils will end up flattening in the x and z axes. I tried adding/multiplying the curve direction, but that was dumb. It still didn't account for rotation. The solution was undoubtedly a rotation matrix.

I had done a similar thing to create random rotation around branches for leaves. The only difference here was that it needed to spiral.


First, you would need to get the direction of the curve using a polyframe SOP.


The attribute it gives you by default it called tangentu. This is a vector attribute that is aimed at each point's previous point. You will be using that as the direction in a rotate function.


You will also need to get a vector pointing out away from the curve. To do this, do a cross product of the curve direction and the current normal.







The rotate function takes 3 inputs (matrix,rotation value in radians,axis). To create an open identity matriyx you need to use the ident() function. The axis is the tangentu attribute. Then you would multiply this by the direction pointing away from the curve and add that value to position.


You should get something like this:

easy


If that was weird or hard to follow, here's a HIP!


cheers!



Recent Posts

See All

VEX SNIPPETS Pt.2

Some more helpful vex that I'm trying to type less often 1: Move to set on Grid and Set Pivot to Origin in a point wrangle... vector centroid = getbbox_center(0); vector dist = centroid - 0; vector mi

Inverse Square Falloff

A while ago I was talking to an FX artist I work with who casually mentioned using inverse square law as a way to calculate falloff. I of course had no idea what he was talking about so I looked it up

VEX SNIPPETS Pt.1

Some helpful vex that I use on the daily 1: Center Pivot and Move to Origin in a pointwrangle.. vector centroid = getbbox_center(0); vector dist = centroid - 0; v@P -= dist; 2: Random Normal in a poin

  • Grey LinkedIn Icon
  • Grey Vimeo Icon
  • Grey Instagram Icon
  • Artstation
  • Grey Tumblr Icon