Houdini 20.0 Nodes Geometry nodes

Attribute Create 2.0 geometry node

Adds or edits user defined attributes.

On this page
Since 12.0

The attribute can be a float, integer, vector, or string type. If the local variable name is not specified, the attribute name (all in upper case) will be used. After adding a user attribute, the local variable can be used anywhere in operations where local variables are allowed.

Note

Strings are added as “Index” attributes, not as actual “String” attributes. This is only important if you are using these with the HDK.

Note

While each attribute is added in turn, you cannot refer to the previous attribute in the values of the next attribute. Each attribute uses the input geometry as its source, not the result of the previous attribute addition.

Parameters

Group

Only elements that belong to this group will be written to by the specified value.

Group Type

What the group is made of.

Encode Invalid Attribute Names

If a Name is not a valid attribute name, encode the name to make it valid. You can recover the original name with decode. When this is off (the default) and you enter an invalid name, the node shows a warning and simply mangles the name by replacing invalid characters with underscores.

This option can be useful if you want name an attribute after an arbitrary string, such as an asset ID from an asset management system, which might contain invalid characters. (Valid attribute names contain only letters, numbers or underscore (_), and must not start with a number.)

Note that you can always call decode on an attribute name if you suspect it may have been encoded, because calling decode() on a string that isn’t encoded simply returns the string unchanged.

Number of Attributes

The number of attributes to add. Each is added in turn. However, all expressions will refer to the input geometry, not the intermediate geometry, so later attributes cannot build on the earlier ones.

Name

Name of the attribute.

Existing Name

Specifies which action should be taken, if an attribute already exists with the same name.

Generate error on mis-matched attribute

An error will be generated and the existing attribute, and its values will be left as-is.

Generate warning on mis-matched attribute

The existing attribute definition will not be changed, but its values will be overwritten if Write Values is enabled.

Replace existing attribute

The existing attribute definition will be replaced completely by the new definition.

Use the better type, size and precision

The new attribute definition will use the better of the old definition’s and the requested definition’s type, size, and precision. For numeric types, float is considered better than integer. String and numeric are considered incompatible and so the requested type prevails in that case.

Local Variable

Name of the local variable that corresponds to the new attribute. If you leave this field blank, the local variable is the name of the attribute in all UPPERCASE.

To access individual components of a multi-component attribute, the user can append to this name:

  • X, Y, or Z for vector attributes.

  • 1, 2, 3, etc. for float attributes. Note that the numbering starts at 1, not 0.

For example:

Attribute Type Local variables created

abc

Float, size = 1

$ABC = $ABC1

abc

Float, size = 2

$ABC1, $ABC2

abc

Vector

$ABCX, $ABCY, $ABCZ

Class

Where to add the attribute to the geometry. Can be a point, detail, primitive, or vertex attribute.

Save to Info Block

Detail attributes can have their values saved to the info block at the start of .bgeo/.geo files. If this toggle is set, the detail attribute will save itself in this way. This allows the value to be retrieved without loading the entire file using the File SOP's Info Load mode or the gstat command line.

Type

Float, Integer, or String. When Type is “Float”, you can use the other menu to set a type qualifier, which tells Houdini how the type should be interpreted.

(Vector is included in the type menu for backwards compatibility. It is the same as setting Type to “Float” and the other menu to “Vector”.)

Vector attributes are a backward compatible setting to specify a float attribute which Houdini transforms as a vector.

Float, integer, and string attributes can also be created as arrays. These allow a varying number of values per element. With arrays you cannot specify defaults or alter their values. The Size field also refers to tuple size, so a size of 3 means an array of vector 3s, not an array 3 floats long.

Float attributes may have further type information specified.

Type qualifier (next to Type)

Guess from name

If the name is N, the qualifier will be “Normal”. If the name is Cd, the qualifier will be “Color”. If the name is v or up, the qualifier will be “Vector”. Otherwise, the qualifier will be “None”.

None

No special treatment.

Position

This attribute is a geometric point. Houdini will transform the attribute as a position.

Vector

Houdini will transform the attribute as a vector.

Normal

Houdini will transform the attribute as a normal.

Color

This attribute is a color.

Quaternion

Houdini will transform the attribute as a quaternion.

Transform Matrix

Houdini will transform the attribute as a transformation matrix.

Texture Coordinate

This attribute represents texture coordinates, like uv. If it is a point or vertex attribute, it will show up in the UV viewport’s UV Attribute menu, and if it is a vertex attribute, some nodes will handle seams in a special manner.

Precision

Numeric precision to use (when Type is not String). See the Attribute Cast node for more information.

Size

Number of elements in the attribute

Note

For arrays, this specifies the tuple size of the array, not the number of entries of the array. A value of 3 for a float array will thus make a vector array.

Default

Default attribute value

Write Values

Turn this off if you want to ensure the attribute exists but not overwrite any existing values.

Allow Local Vars

Turning this off will disable local variables in the Write Values field. This can provide some minor performance improvement when working with very small geometry.

Value

Numeric value to write to the attribute.

String

String value to write to the attribute.

Note

Vector attributes are modified by transforms. Float attributes are not.

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.

Examples

CurveTexturing Example for Attribute Create geometry node

The AttribCreate SOP can be used to provide various object-specific attributes by allowing both a label and a value to be given to the newly created attribute.

In this example, the AttribCreate SOP is used to control the width of a curve at rendertime. There are two versions, chosen by a Switch SOP.

  • One AttribCreate SOP gives a constant width attribute in the X axis.

  • The other uses an expression to control the thickness of the curve to create a tapering effect.

The attribute is used by Mantra at render time. To see the results, right-click on the render icon in the viewport, and choose “render_example”.

See also

Geometry nodes