Houdini Sink

SideFX Houdini #note/sink

TOC

Camera focus distance from object

vlength(vtorigin("../cam1", "../null1"))
vlength(vtorigin(".", "../null1"))

https://vfxbrain.wordpress.com/2020/07/07/camera-auto-focus/

Local render

Using hrender.py

option description
-e Frame range flag ?
-f start end Specify frame range
-F frame Single frame
-w pixels Output width
-h pixels Output height
-t take_name Take to use for rendering
-o output Output name. Use $F in a filename to include the frame number
-c cop Render a compositing node/network
-d rop Render a render node

If you only specify one of -w or -h, the output will maintain the aspect ratio of the size specified on the node

cd "C:\Program Files\Side Effects Software\Houdini 19.5.640\bin\"
call hython.exe hrender.py -e -f 1.0 250.0 -i 1 -d /out/your_rop_name "you_file.hiplc"

Vectorize Images using Clusters

Vectorize pixel images using cluster points node
https://www.youtube.com/watch?v=tWVJgWVv9oc

Viewer states, handles, HUDs

Creating custom HUD, transforming into camera space

https://www.youtube.com/watch?v=9eYwRKJPzLw

Python States for Houdini TDs

https://ambrosiussen.gumroad.com/l/pythonstatesforhoudini

H19 grouping behaviour change

Old: !group1 !group2 !group3 implicit AND operation is now OR in H19
New way: !{group1 group2 group3} more explicit AND

Pulling/sharpening point clouds

Attribute Blur set to Proximity mode will gather nearby points. It’s a brilliant trick.

Multiple textures per attribute

Using Style sheets or overrides

OGL pscale visualization

New pscale visualization feature in H19
Create a detail wrangle and type in i@gl_spherepoints = 1 - it creates a nice sphere primitive visualizer that seems to perform better than viewport discs or sprites in some cases!

Accessing attributes in parameters

Point attributes

// 'opinput:X' is the most legible and always works (the first input is input 0).
point('opinput:0', 'P', i@ptnum)
point('opinput:1', 'P', i@ptnum)

// The integer input number (the first input is 0). Some functions don't support this but it's easy to type.
point(0, 'P', i@ptnum)

// Absolute and relative paths to other nodes look like this.
point('op:/obj/geo1/OUT', 'P', i@ptnum)
point('op:../../OUT', 'P', i@ptnum)

Detail attributes, do not forget the last index is required

detail('op:../../OUT_pt', 'pcount', 0)
detail("../foreach_count1","iteration",0)

In string parameters

In string parameters (such as filenames, or the text created by the Font node), the text in the parameter is treated as text. Variables are expanded, but to use math or expression functions to generate part of the text you must place the expression within backticks. For example:

    frame`padzero(5, $F)`.pic

…giving you filenames such as frame00001.picframe00002.pic, and so on.

Get current camera

Python expression to get the path to the current viewport's camera

cd = hou.ui.curDesktop()
tab = cd.paneTabOfType(hou.paneTabType.SceneViewer)
vc = tab.curViewport()
return vc.cameraPath()

Quaternion rotation and orient attribute

@pscale = 0.1;
v@up = {0,0,1};

matrix3 m = maketransform(v@N,v@up);
p@orient = quaternion(m);

float rotation = chf("rotation");
vector4 rotation_quaternion = quaternion(radians(rotation),{0,1,0}); // the second arg is rotation axis 
p@orient = qmultiply(p@orient, rotation_quaternion);