Houdini 20.0 Nodes Dynamics nodes

Geometry Wrangle dynamics node

Runs a VEX snippet to modify attribute values.

On this page
Since 13.0

Overview

This is a very powerful, low-level node that lets experts who are familiar with VEX tweak attributes using code.

This node corresponds to the Geometry VOP DOP, but uses a textual VEX snippet instead of a VOP network.

This node runs the snippet on the detail or every point/primitive/vertex (depending on the Run Over parameter) in the input geometry. The snippet can edit the input geometry by changing attributes. It can access information from other geometry using attributes and VEX functions.

  • Press MMB on the node to see any error output from the snippet.

  • You can use the VEX function ch to evaluate parameters. The path is relative to this node (ch("parm") will evaluate the parameter parm on this node). This evaluation will be done at the current time.

  • Unlike the Attrib Create SOP, this does not use local variables. Further, all backtick expressions and $F variables will be evaluated at frame 1, not the current time. Use @Frame, @Time, or @TimeInc instead.

Context

This node runs the snippet in the CVEX context.

Syntax

The VEX snippet parameter lets you enter a snippet of VEX code to run on the input geometry. See VEX snippets for basic information on the syntax available in the snippet parameter. See the VEX chapter for general information on the VEX language.

Parameters

Code

Group

A subset of points in the input geometry to run the program on. Leave this blank to affect all points in the input. The type of group must match the Run Over parameter.

Run Over

Apply the VEX code to each component of this type (points, primitives/faces, or vertices. Or choose Detail to run the code only once. For each component, the code runs with attributes bound to variables starting with @ (for example @Cd) for reading and writing.

If you choose Numbers, Houdini runs the code for certain number of iterations instead of over components. In this mode the code only has read-only detail-level attributes bound to @ variables.

Number Count

When Run Over is Numbers, the number of iterations to run the code. In each iteration, @numelem is bound to this total count, and @elemnum is bound to the iteration number, from 0 to @numelem - 1.

In this mode the code only has read-only detail-level attributes bound to @ variables.

Thread Job Size

When Run Over is Numbers, this is the number of iterations to run per separate thread. If this number is greater than or equal the Number count, all iterations will run serially in a single thread. If this is 1, each iteration will run in a separate thread. In between, the node will group the iterations into batches of this size, and run each batch in parallel on separate threads.

VEXpression

A snippet of VEX code that will manipulate the point attributes. You can use @variable_name syntax to access geometry attributes.

Attributes to Create

Only create attributes if their names match this pattern. The default pattern allows any attribute to be created.

You can restrict the created attributes by replacing the * with a list of allowed names.

Bound attributes, such as vtxnum, cannot be created and will be ignored.

Enforce Prototypes

Requires that you declare @ bindings in snippets as prototypes before using them. This applies to both attributes (for example @Cd) and “convenience” bindings such as @ptnum and @Frame. For example:

// Declare bindings
int @ptnum;
float @Frame;
vector @Cd;

// Use bindings after declaration
int pointnum = @ptnum;
float red = @Cd[0] / @Frame;

Automatic binding with the @ syntax can be convenient, but as your scene becomes more complex there is the risk that a typo in an @ binding will silently just bind a non-existent attribute.

Use Timestep

Determines if the current solver timestep will be used to apply this node.

If set, the current timestep size will be multiplied by the scale and used for the time increment for this operation. Otherwise, the time scale will specify an absolute fictitious time to integrate by.

By disabling the link between the actual real time and the microsolver time, you can perform operations in a separate, fictitious, time.

Time Scale

The timestep used for this microsolver will be scaled by this amount. This allows one to achieve non-realistic effects, such as parts of the simulation operating at different speeds than other parts.

Similarly, it is useful if a solver needs to be evaluated independently of the main timestep.

Data Bindings

Geometry

The list of the geometry on the object to process.

Evaluation Node Path

VEX functions like ch() usually evaluate with respect to this node. Providing a path here can override where the path search starts from. This is useful for embedding in a digital asset where you would like the top level digital asset to be the search root.

Time Scale

An overall scale applied to the actual timestep.

Export Parameters

When a VEX parameter is exported, the bound attribute will be created if it doesn’t exist. This pattern can be used to override the export option on the VEX shader to avoid writing to or creating certain attributes. The pattern matches the VEX parameter, not the bound attribute. The attribute will still be bound for reading.

Autobind by Name

Will use the name of the attribute to determine which attribute binds with which parameter.

Integer attributes will bind to integer parameters. Float attributes will bind to float, vector, point, matrix, or matrix4 depending on their tuple size. String attributes will bind to strings.

Attribute Name, VEX Parameter

Manually specifies the bindings of each attribute.

Field Name, VEX Parameter

Optionally binds Scalar, Vector, Matrix, or Index fields from this object to the CVEX function. They will be sampled at the current P location of each element.

You can then access these with the @ syntax referring to the given Parameter.

Autobind Groups by Name

Automatically bind any groups to the integer parameter prefixed with group_.

Group Name, VEX Parameter

Manually specifies the bindings of each group.

Update Normals If Displaced

If points are being run over, and the P attribute is written to, but the N attribute is not written to, any incoming normals will become out of date. When this option is set, vertex and point normals will be updated when this occurs.

VEX Precision

VEX can evaluate at 32-bit or 64-bit precision. 64-bit provides higher accuracy, especially for transforms.

Note

Incoming attributes will preserve their original precision, so using 64-bit VEX on 32-bit positions will convert them to 64-bit, apply the operation, then convert back to 32-bit when writing out.

The auto mode will switch between 32-bit and 64-bit depending on the preferred precision of the incoming geometry. When run in 64-bit precision, any created attributes will be 64-bit. When run in 32-bit any created attributes will be 32-bit. Use Attribute Cast to change the preferred precision.

Inputs

Input 1, 2, 3, 4

These control the four virtual inputs accessible inside of VOPs.

They can be accessed with the OpInput1-4 wires from the VOP, or with the @OpInput1-4 string parameters when using VEXpressions.

They can also be accessed numerically as 0-3 with VEX functions that take an input number.

None

No geometry is wired to this input.

SOP

The SOP geometry will be cooked prior to running the VEX and the result wired to this input.

DOP Data

Data in the current simulation to reference. Specified as an object/data, for example, pyro1/vel to refer to the velocity field of the pyro1 object (which will show up as three volume primitives).

Myself

Referring to the geometry currently being processed is special as you have to ensure a copy is made so the VEX functions can refer to its original form. This handles that for you.

Nth Context Geometry

These refer to the SOPs wired into the parent DOP Network itself.

Myself (No Reads from Outputs)

Refers the currently processed geometry. Does not make a copy so it is up to the user to ensure no reads are made from any attributes that are bound.

SOP Path

Path to a SOP to wire in.

DOP Data

Object/data path of a piece of DOP data in THIS simulation to wire in. If Use This Object’s Data is enabled, this specifies the data path for data attached to the currently solved object.

Use This Object’s Data

When enabled, the DOP Data specifies the name of data attached to the currently solved object. This is usually equivalent to $OBJID/DataName, but using $OBJID requires one to set the Solver Per Object toggle which prevents mutual affectors from working with solvers such as RBD. If the referenced data is the geometry being currently processed, a copy is made (similar to the Myself binding option).

See also

Dynamics nodes