Houdini Programming

From MyCGDoc
Revision as of 22:09, 12 August 2019 by Mdadminpal (talk | contribs) (Add channel template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Environment Variables

Variable $ Description
General
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
Channel
Operator String String $OS Refers to a node's title name.
Playback
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.
Math
pi Constant $PI
e Constant $E

Reference:



Attributes

Attribute Type @ $ Description
Geometry
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.
Points
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.
Particles
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

Reference:



Syntax

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

Template

Channels

Noise

anoise()

Formatting

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.