If you are using setattrib and are modifying a point from different source points, set the mode argument to "add" to composite the results.
Only use setattrib if you need to do set an attribute on other elements. It’s faster to set attributes on the current element using bound variables (for example = val) rather than setattrib. Use setprimintrinsic to modify things like the transform of sphere primitives. To set group membership use setpointgroup and setprimgroup. You can remove geometry using removepoint and removeprim. You can alter geometry using setattrib and setprimvertex. The addpoint, addprim, and addvertex functions let you create points, primitives, and vertices. You can create geometry with VEX snippets in certain nodes, such as Attrib Wrangle. The table of known attributes below lists attributes that Houdini can automatically cast. Houdini knows to cast some commonly used attributes using the appropriate VEX datatype. For example, in the Volume Wrangle node, you can use to get the center of the volume. Some nodes may provide additional attribute-like variables you can read to get computed information about the geometry. contains the total number of elements in the geometry/list. contains the number of the current element being processed. Houdini provides some attribute-like variables you can use in the snippet. (The Volume Wrangle node will not create new volumes this way.)
#Equirectangular vdmx code#
If you write to a in the VEX code and the attribute does not exist, Houdini will create it. In the Volume Wrangle node, you can use volume_name to read or write to a volume. Instead they affect the particles by varying the parameter values per-particle. Particle DOPs can access particle attributes but can’t modify them. In the snippet, you can read/write the value of an attribute using attribute_name.įor example, to read or write to the P (position) attribute, use in the VEX code. For geometry manipulation, however, wrangling and VEX/VOPs is the way forward, and it’s worthwhile to learn the new workflow. HScript will probably always be available for certain jobs where it’s handier than VEX. This simple fact is the reason why VEX will only become more widely used to replace HScript expressions for ad-hoc geometry manipulation. VEX has gained equivalents of most HScript expression functions, and is easier to use for things like array and string processing, with conveniences such as Python-like array/string slicing and Python like dictionaries.Īs users work on ever-larger and more complex geometry, threading and parallel processing become more and more important to get acceptable performance. Passing information down the network on attributes is inherently friendlier to parallel processing than using external references on later nodes to data on earlier nodes.Ĭurrently, VEX operations are supported inside compiled SOP blocks, but HScript expressions using local variables cannot be compiled. In VEX this is much easier: Since technical work in Houdini often revolves around attributes, this can actually make VEX expressions a lot simpler than the equivalent HScript expressions. In HScript expressions, getting the value of an attribute that didn’t already have a local variable mapping set up in the node was a chore (for example, point(opinputpath(".",0), $PT, "my_var", 0)). Working directly on attributes instead of local variables actually has some ease-of-use advantages, since the naming of local variables could be inconsistent with the underlying attribute’s name, and inconsistent from node to node. It runs faster and automatically supports threading and parallel computation. Using VEX and attributes has major performance benefits over HScript expressions and local variables. For performance reasons, Houdini is moving toward doing ad-hoc geometry modifications with VEX operating on attributes, rather than HScript expressions operating on local variables and external channel references.