Houdini general sink

· Houdini MOC · #note/sink ·


Camera focus distance from object

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


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

Viewer states, handles, HUDs

Creating custom HUD, transforming into camera space


Python States for Houdini TDs


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)

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.


* Matches any string
? Matches any single character
[chars] Matches any of the characters between the square brackets. This does not support character ranges using a hyphen (you cannot do [a-z])
^pattern Removes strings matching pattern from the previous match
@name Matches attribute, object group, channel group, and/or bundle (depending on context)

geo* Matches everything beginning with “geo”.
[gG]eo* Matches everything beginning with “geo” or “Geo”.
?eo* Matches everything that has any character followed by “eo” and then any number of characters.
* { #geo1} Matches everything except the string “geo1”.

Group syntax


Pattern Meaning
* All points, primitives, vertices, or edges. To match no elements, use !*
?* Match anything in a named group
n Component number n
group_name In SOPs other than the Group SOP, you can specify a named group of points/primitives (created with the Group SOP).
You can use pattern matching (*, ?, and [ ]) in the group name. For example, arm* includes all point/primitive groups whose names start with arm. ^ can be used in the pattern by enclosing the pattern in { }. For example, `{arm*
*}includes all groups whose names start witharm, but not arm3`.
n-m Components numbered from n to m (inclusive).
n-m:step Components numbered from n to m (inclusive), skipping every step. For example, 1-100:2 means every other number from 1 to 100
n-m:keep,step Components numbered from n to m (inclusive). Use the first keep numbers and then skip every step after that
!pattern Every component except the ones matching the pattern.
For example, !1-10 means every point/primitive except the numbers 1 to 10.
pattern may be a numeric pattern, attribute pattern, or group name pattern
^pattern Remove components matching the pattern from the results of the preceding pattern.
For example, `0-100:2
` means every other number from 1 to 100 except the numbers 10 to 20. pattern may be a numeric pattern, attribute pattern, or group name pattern
@attributeopvalue Components where attribute matches value, based on the op, which can be one of =, == (same as =), !=, >, <, >=, or <=.
@attribute=val,val,... Components with the given attribute containing one of the listed values.


For example @v>0 will create a group of all points whose v attribute is greater than 0.

You can specify components using [index], for example @Cd[2] will get the blue channel of the diffuse color (Cd) attribute.
As a convenience, you can also use .x/.y/.z, .u/.v/.w, or .r/.g/.b instead of [0], [1], and [2].
(If you don’t specify a component for a multi-component attribute type, the comparison will use the first component.)
For example, @P.y>0 will create a group of all points whose Y component is greater than 0.

For string attributes, you must put quotation marks around the value if it contains spaces, for example @myattr="foo bar".
You can use wildcards (* and ?) in the value when using =, ==, and != on string attributes.

You can combine the attribute syntax and the range syntax: @id=5-10
You can also use the attribute syntax with an integer pattern, but you need to enclose the pattern in quotes: @id="5 8 10 15" @id="0-4 78"
You can use this to compare against intrinsic attributes as well: @intrinsic:indexorder<100

Val list example: @id=1,2,90,120
For string attributes, you must enclose values containing spaces in double quotes, for example: @path=/foo/*,/bar,"some string"

Edge syntax

Pattern Meaning
n All edges in primitive number n
pn Point number n / edges with point number n
nem Edge number m of primitive n
pa-b Edges between point number a and point number b

ROP node


The workflow of these options is the same found in Mantra or other renderers.

Candidate Objects The geometry objects in this parameter will be included in the render if their display flags are turned on and their display channel is enabled
Force Objects Objects in this parameter are added to the render regardless of the state of their display
Exclude Objects Objects in this parameter are excluded from the scene, regardless of whether they are selected in the Candidate Objects or Force Objects
Candidate Lights Each light in this parameter is added to the render if they are enabled
Force Lights The lights in this parameter are added to the render regardless of the value in their enable channels
Exclude Lights These lights will be excluded from the scene, even if they are selected in Candidate Lights or Force Lights
Forced Matte Objects forced to be output as matte objects. The matte options are extracted from a reference OBJ node, that can be even a null with the RS spare parameters added to configure on it the matte options
Forced Phantom Objects forced to be output as phantom objects. This means that they are not visible to the camera rays


Common symbols

% modulus, remainder on integer division
&& logical operator AND
|| logical operator OR
>= greater than or equal (Do not reverse the order – won’t work)
<= less than or equal
< less than
> greater than
== equal comparison
!= not equal
`` backticks convert an expression into a string ie. ch(“../someparameter”) in the font node would print that verbatim, but putting this i backticks would give me the value
if if (condition, then part, else part), example if ($F > 0, 1, 0 )
ifs as above but returns a string, for example ifs($F>1,”Hi”,”There”)
int() integer, similar functions floor(), ceil(), round()
$F frame number integer
$FF frame number float
$CY copynumber, local to the copy node so to get the information to a node above you need to stamp it to retrieve it you use stamp expressions
stamp stamp(“../copy1”,”kermit”, 0) = stamp(node it is from, name you called the variable, default value just incase )

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);

RBD speedup

Redshift can be really slow with degenerate primitives created by Voronoi Fracturing. Unpack & add Clean SOP before sending to RS.
Also delete all unnecessary attributes before unpacking, especially sim attributes generated by the RBD solver. Each attribute adds a little bit of time to the unpack and to the RS scene extraction!