Houdini 20.5 Nodes Geometry nodes

Attribute Cast geometry node

Changes the size/precision Houdini uses to store an attribute.

On this page
Since 12.0

Overview

This changes the precision and amount of memory used to store an attribute. You can use this to get greater precision for floating point operations at the cost of increased memory usage, or lower precision to save memory for very large models.

For example, if your use case can tolerate 16-bit float precision, for a point attribute on a model with 100 million points, using real16 would save 300 MB.

Notes and warnings

  • Not all operations in Houdini maintain 64-bit precision.

  • Storing out-of-range values in a low-precision attribute (for example, storing 130 in an int8 attribute) does not raise an error. Instead, the value wraps around (for example, storing 130 in an int8 stores -125).

    You may need to add bounds checking to your own scripts/expressions if necessary to work around this.

  • When a script or expression reads an attribute, the attribute’s value is converted to the usual numeric type for the scripting environment. For low precision attribute types, this means you can use higher precision/range for intermediate results before you store the value back to the attribute.

Available storage types

Type name Description Range
int8 8 bit integer (1 byte). -128 to 127
int16 16 bit integer (2 bytes) -32768 to 32767
int32 32 bit integer (4 bytes) -2147483648 to 2147483647
int64 64 bit integer (8 bytes) -9223372036854775808 to 9223372036854775807
real16 16 bit float (2 bytes), about 3 decimal digits of precision. Maximum value about 104
real32 32 bit float (4 bytes), about 7 decimal digits of precision. Maximum value about 1038
real64 64 bit float (8 bytes), about 15 decimal digits of precision. maximum value about 10308

Parameters

Set Preferred Precision

Geometry in Houdini has a preferred precision that nodes can use as a hint for what precision to operate on or to generate attributes with. In particular, default VEX nodes will run in this precision. Setting it on the geometry allows downstream operations to work in the desired precision without having to update all the nodes.

Number of Casts

The number of different type conversions you want to do. Click the + button to add another conversion.

Class

The class of attributes to change.(vertex, point, primitive, or detail).

Attributes

A space-separated list of attribute names to change. You can also use patterns here. For example, foo, bar*, or P C*.

Precision

The new storage type for the attribute(s). See available types above.

In addition, Convert to Preferred will widen or narrow the type to the geometry’s current preferred precision. The type of the attribute, integer or float, will be preserved by this conversion.

Locals

Note

Variable names ending with 2 refer to the geometry from the second input, if applicable. For example, PT2 is the current point number from the second input.

AGE

The seconds a particle in the template has been alive.

ARC

Arc length distance from root in the L-systems.

AREA

The surface area of the primitive (created by the Measure SOP).

BBX, BBY, BBZ

The point’s relative position in the bounding box.

CA

Point or vertex alpha value.

CEX, CEY, CEZ

The centroid of the geometry.

COMX, COMY, COMZ

Center of mass.

CR, CG, CB

Diffuse point or vertex color.

CREASE

Point or vertex crease weight value.

DIST

Distance from particle to last collision.

DIV

Number of divisions to build the circle swept with Polywire (created by L-systems).

DRAG

Point drag.

GEN

Generation in the L-systems.

ID

The ID of the particle in the input.

LAGE

The age of the point in the L-system computation.

LIFE

Percent of total life used (from 0 to 1).

LOD

Level of detail.

MAPU, MAPV, MAPW

Point or vertex texture coordinates.

MASS

Point mass.

MAT

The string name of the current material (the value of the shop_material attribute).

MAXLAYER

The number of layers that are considered active for display.

NPT

The total number of points in the template geometry.

NX, NY, NZ

Normal vector.

PERIMETER

The perimeter of the primitive (created by the Measure SOP).

PR, NPR

Primitive number & total number of primitives.

PSCALE

Particle Scale.

PT

The point number of the currently processed point.

RESTX, RESTY, RESTZ

The rest position.

SEGS

Number of segments to divide a curve up into in Polywire (created by L-systems).

SIZEX, SIZEY, SIZEZ

The size of the bounding box.

SPRINGK

Elasticity of a point.

TENSION

Spring tension of an edge.

TX, TY, TZ

Point position.

TW

See WEIGHT.

UPX, UPY, UPZ

The vector pointed in the up direction.

VTX, NVTX

Vertex number & total number of vertices.

VX, VY, VZ

Velocity direction.

WEIGHT

Point spline weight.

WIDTH

The width of the curve. Used by mantra for rendering curves & polywire for generating trees.

XMIN, XMAX

The X extents of the bounding box of the geometry.

YMIN, YMAX

The Y extents of the bounding box of the geometry.

ZMIN, ZMAX

The Z extents of the bounding box of the geometry.

See also

Geometry nodes