# houdini

## VEX: Rotation Around Axis

float angle = chf(“angle”); vector4 rot = quaternion(radians(angle), {1,0,0}); @N=qrotate(rot, @N);

## Python: Phyllotaxis

node = hou.pwd() geo = node.geometry() # Add code to modify contents of geo. # Use drop down menu to select examples. from math import radians, sqrt, sin, cos numpoints = 200 angle = 137.508 cval = 0.2 for i in range(numpoints): theta = radians (i * angle) x = cval * sqrt(i) * cos(theta)

## Python: Split Into Groups

This little script for Houdini is one I’ve had knocking about and thought might be useful to throw out onto t’interweb. Select the node at which you want to split out the groups and it will create a bunch of blasts and OUT nodes to separate out per group. import hou selectedNodes = hou.selectedNodes() for

## Awards: JD.com – “Joy & Heron”

“Joy & Heron” has picked up a few awards in recent weeks. A Gold Ciclope for Long Form Animation A Silver LIA for Production & Post-Production: CGI Animation Golds  at The One Show Awards for Online Video, Branded Entertainment, and Animation.

## VEX: split string and convert to integer

//Split @anotherAttribute based on ‘_’ string myString[] = split(s@anotherAttribute, “_”); //Use last element as attribute value s@tempString = myString[-1]; //convert string to integer i@myIntegerFromString = atoi(s@tempString);

## VEX: Bend Wrangle

Taken from https://tosinakinwoye.com/2017/01/23/houdini-vex-snippets/ //Input is a line //Resample SOP on line for more points //Activate curveu attrib in resample SOP //Remap curveu to shape of bend @curveu=chramp(“ramp”,@curveu); float bamt = chf(“bend_amt”); //bend amount vector benddir = chv(“bend_dir”); //bend direction @P+= benddir * bamt * @curveu;

## Houdini Python: Find/Replace Parameter Expression

A little script to find/replace strings in selected nodes’, parameter expressions: import hou sel = hou.selectedNodes() dialog = hou.ui.readMultiInput(‘Find/Replace In Expression’, input_labels=[‘Find: ‘, ‘Replace: ‘,], buttons=("Find/Replace", "Cancel"), severity=hou.severityType.ImportantMessage, title=’Find/Replace’, close_choice=1) find = dialog replace = dialog if dialog == 0: for n in sel: for parms in n.parms(): try: newString = str(parms.eval()).replace(find, replace) parms.set(newString) except:

## VEX: SOP Rotation

f@speed = fit01(rand(@ptnum), ch(‘minSpeed’), ch(‘maxSpeed’)); float angle = (ch(‘angle’)+@ptnum)*@speed; vector axis = sample_direction_uniform(rand(@ptnum*ch(‘seed’))); @orient = quaternion(angle, axis);