Houdini 20.0 Nodes Dynamics nodes

Gas Field Wrangle dynamics node

Runs CVEX on a set of fields.

On this page
Since 13.0

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

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

This node runs the snippet on every voxel in the input volume(s). The snippet can edit the input geometry by changing attributes. It can access information from other geometry using attributes and VEX functions.

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.

Reading and modifying the voxel value

The current voxel value in a volume is available as @volume_name. You can read this variable to get the current value, and assign it to change the value. For example, to add 0.1 to the value of every voxel in the float volume foo:

@foo += 0.1

If a volume does not have a name, it will automatically be bound to @density.

If you have multiple named volumes in the input, you can write a single snippet that modifies the different volumes in different ways, for example:

@foo += 0.1
@bar += 0.2
@baz += 0.3

VEX variables

You can create temporary variables. For example, the following code reads an offset location from a point.

vector temp = @P;
temp += {0.1, 0.2, 0.3};
@density = volumesample(@OpInput1, 0, temp);

Bound Variables

A number of variables are bound in the Volume VOP context. Use the @ prefix syntax to access them.

ix, iy, iz

The integer index of the current voxel. With VDBs, this can be negative.

resx, resy, resz

The resolution of the current volume primitive. For VDBs this is the size of the active voxel region.

dPdx, dPdy, dPdz

Vectors giving the length and orientation of the x, y, and z edges of the 0th voxel.

center

The center of the volume in SOP space.

SimTime

Current simulation time in seconds.

SimFrame

Current simulation frame.

Time

Current playbar time in seconds.

Frame

Current playbar time in frames.

TimeInc

Time increment between frames, in seconds.

OpInput1, OpInput2, OpInput3, OpInput4

A string that can be used to refer to the corresponding input of this SOP in vex operations that take file parameters.

Parameters

Code

Group

Only run the program on these volumes in the input geometry. Leave this blank to modify all volumes in the input.

(See reading and writing voxel values above.)

VEXpression

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

Fields to Write to

Only modify fields if their names match this pattern. The default pattern allows any volume to be modified. You can speed up the node by only listing fields that are actually modified by the snippet.

For example, in the following snippet, only the density field is modified. The temperature field is not modified, only read.

@density = @temperature;

However, the node will both modify density and copy temperature, which uses time and memory. To prevent this, you could set this parameter to density to prevent the node from copying temperature. This requires that you explicitly manage the list of writable fields.

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.

Bindings

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.

Export Parameters

This pattern can be used to override the export option on the VEX shader to avoid writing to certain volumes. The pattern matches the VEX parameter, not the bound volume. The volume will still be bound for reading.

Stencil Field

A scalar field to use as a stencil for where to evaluate the VOP network. Voxels that are strictly greater than 0.5 will be run through the VOP network, others will be left unchanged.

VEX Precision

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

The auto mode will currently run in 32-bit mode as fields are always 32-bit.

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).

Nth Context Geometry

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

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).

Use Timestep

Whether to scale the Time Scale by the current timestep. If off, Time Scale is an absolute time in seconds.

Time Scale

An overall scale applied to the actual timestep.

See also

Dynamics nodes