VEX/VOPS and a little Python
For more information on Python in Houdini
Updated on Jan 30 2014
Updated on Sept 7 2016
Also take a look at this description on odforce between hscript, vex/vops and python.
VOPS is Houdini's visual
interface to VEX. Vex stands for Vector expression language.
Both are native to Houdini. Introduced for writing shaders,
expanded to SOPS, wranglers added ability to use VEX everywhere.
VEX is becoming more popular
with the introduction of wrangle
nodes and VEX snippets. (use for writing shaders
and custom nodes)
VEX looks similar to old rsl
and C in terms of syntax. VEX is also very efficient (close to
compiled C++ code). VOP is a pictoral representation of VEX
code. Both can be used to create sops and are used in other
contexts (dops, pops, shops). As of version 14 and up, vops are
contextual (ie. point vop - (about 10x faster than the
point SOP), attribute, primitive, vertex, volume VOPS).
To create the containers to place the
- point VOP - create a node in the tab menu, for example Point VOP, dive in to play.
- VEX requires an otl (digital asset) to
store the code. The method to create a VEX sop is analogous to
creating a python sop which is described here or in
the example below.
- wrangle nodes (using VEX snippets)
TIP: on wrangle nodes, use
the examples on the side (down pointing triangle) for quick syntax
python can be created as described above, or
through the tab menu.
(Alternatively you could also create a vfl file with VEX code and compile it using vcc to create an otl/hda).
Once you have the otl created you can select
the operator from your Digital Asset menu in the appropriate
context and continue to refine your otl using the Edit VEX
Function button on your node or use Type Properties
and going to the Code tab.
- SideFX documentation on VEX, VEX language reference, VEX functions (built-in), and Using VEX expressions (snippets)
- VEX compiler pragmas (for building UI in your nodes)
- Wagner's Webinars: Houdini VEX
on Houdini Vex
ExampleAn example of moving a point along a normal is given in the following sample files (zip files that contains the otl for the VEX and python versions - be sure to refresh your digital asset library). Updated for version 14 and up (older version 13.)
In H13, note that in the VEX and VOP version, the normal is automatically post recomputed, however in the python version it is not. A facet node is used to achieve the same result. (See forum post about normals). New to H14, VOPS no longer recomputes the normals, only VEX does.
Lecture PDF for moving a point along a normal (updated for version 14 and up) here.