Houdini Programming

From MyCGDoc
Jump to navigation Jump to search

Environment Variables

Variable $ Description
File Directory $HIP Directory where current Houdini scene file is located.
Project Directory $JOB Directory where current Houdini project is located.
Scene File Name w/out Extension $HIPNAME Does not include file extension, $HIPFILE does.

Global Variables

Variable Type @ $ Description
Operator String String $OS Refers to a node's title name.
Time Float @Time $T Current time in seconds
Frame Integer @Frame $F Current frame
Simulation Timestep Float $SF Current simulation timestep number as applicable in dynamic simulations.
Fractional (Sub) Frames Float $FF Applicable for precision, such as motion blur.
Frames Per Second Float $FPS Set in the Global Animation Options.
pi Constant $PI
e Constant $E



Attribute Type @ $ Description
Position Vector3 @P Position of element.
Normal Vector @N Normal vector of the element.
Color Diffuse Vector3 @Cd Color diffuse using RGB values for the vector3.
Point Number Integer @ptnum Point number
Scale (Uniform) Float @pscale Uniform scale of element.
Scale (Non-uniform) Float3 @scale Non-uniform scale with each float representing each axis: x, y, z.
Orient Quaternion @orient Orientation of the element. This takes precedence over @N if both @N and @orient exist in element. But if @orient does not exist in element, then @N defines its orientation along Z-axis. Since @N is simply a vector and @orient is a quaternion, then @orient has greater precision, and therefore precedence.
Id Integer @id Unique value identifying an element, such as a particle. Even after it dies, another element or particle will not acquire that id value.
Age Float @age Denotes the time that the particle has been in existence since spawning, or being born, from its origin. Value is in seconds and typ. noted as fractions per the frame rate.
Life Float @life Number of seconds that the particles are expected to live. Defined in the POP Source.
Age / Life Float @nage Unlike @age, which is just a recording of time that the particle has been alive, @nage is a percentage of how long it has been alive relative to its @life. It is an implicit value denoting @age / @life.
Dead Integer @dead An attribute to mark particles that have @age > @life.
Heading Placeholder
Placeholder Type VEX Variable Description



Accessing Dynamics Data

Dynamics data from a DOPnet can be referenced, but uses the following syntax to access the data within the dynamics object. The colon (:) is used to separate the network path from the object and data located within. For example, accessing the Geometry data within an RBD Packed Object would be denoted as:

    network path:rbdpackedobject/Geometry

Reference: SideFX: Dynamics Data Reference Syntax

VEX Scripts






Format String

VEX Resources

Python Scripts

Program Startup
Upon starting up Houdini, the 123.py file is noted with the following script (create_geoNode.py) to automate the creation of a geo node at the object level with specific settings.
Set Auto Group Name
The Group SOP can use this script (set_groupName.py) to set the group name to the name of the node, which mitigates the need to set the group name parameter within the SOP and the SOP name itself. Ultimately, this aligns the name of the node with the group name and can help with keeping group names organized.