Houdini Resources

Updated on June 26  2024


Vex/Vops/Python

Deborah R. Fowler



VEX/VOPS and a little Python

For more information on Python in Houdini click here.

Updated on Jan 30  2014
Updated on Jan 15  2024


Also take a look at this description on odforce between hscript, vex/vops and python.


Introduction

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). For examples of wrangle nodes, see page on wrangle nodes.

Both VEX and python code are easily integrated by using their corresponding nodes, however you may also use a digital asset as described below. This is handy for production sharing.

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 code/nodes into:

TIP: on wrangle nodes, use the examples on the side (down pointing triangle) for quick syntax help

python nodes can be created as described above, or simply through the tab menu.
missing image
(Alternatively you could also create a vfl file with VEX code and compile it using vcc to create an otl/hda). In H16 this is the only way to get a new geometry operator. See forum post 
https://www.sidefx.com/forum/topic/50606/

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.


Resources


Example

An example of moving a point along a normal is given in the following sample files (zip files that contains the hda for the VEX python version - be sure to refresh your digital asset library). Updated for version 16.5

Note that when you are using random you need to specify if it is 3D or 1D (if you see dotted lines on the connection it indicates a mismatch of variable type)
So in the example of moving a point along a normal, be sure to set the random function to vector output




missing imageIn 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.(older version16
version 14
  version 13.)


Lecture PDF for moving a point along a normal (updated for version 16) here.

For examples of vex snippets click here.


Example of zscale

Comparision of vex and vops noise - keep in mind you can visualize the code by right clicking on a VOP node and you can use the VOP functions inside of VEX by including the line
#include <voplib.h>

An example is shown in this hip file between noise in wrangles (primitive) and a vop
vopsVersusVexNoise19.5.hipnc


A note about VEXpressions (click on image for sample file H18.0.499)
MISSING IMAGE