Houdini 20.0 Geometry

Geometry attributes

Describes how Houdini represents geometry using details, primitives, points, vertices, and attributes.

On this page

Attributes

Attributes are named values stored on vertices, points, primitives, and objects. Point color, position, UV coordinates , spline weight (W), and normal, for example, are stored as point attributes.

  • Houdini sets some point attributes that you can use in expressions. For example, you could set the per-point color based on the vertical position (PY) of the point.

  • You can set certain attributes manually, and if the attributes are present, they will be used by Houdini. For example, the dynamics solvers and rendering engines will often use certain attributes on the geometry if they exist.

  • You can also set your own custom attributes to be used by node expressions, scripts, exporters, etc.

The surface nodes in the Attributes group of the tab menu set different types of attributes. You can also set or create arbitrary attributes using the Attribute SOP.

To see the attributes on a node’s geometry, RMB click on the node in the network editor and choose Spreadsheet to open the geometry spreadsheet for the node.

Geometry components

You can create and set attributes using the generic Attribute Create surface node, or the Vertex, Point, and Primitive nodes. You can attach attributes to vertices, points, and primitives (e.g. polygon faces), or the entire piece of geometry (called the detail level).

Note

When you merge two or more branches in a geometry network, and a detail attribute with the same name exists in multiple branches, Houdini uses the value in the first branch. If the attribute is a string array, Houdini merges the arrays.

Attribute precedence

When two components in the same geometry have an attribute with the same name, the attribute on the “lower level” of geometry is used:

  • Vertex attributes override:

    • Point attributes, which override:

      • Primitive attributes, which override:

        • Detail (whole geometry) attributes

Applying nodes based on attribute values

Most surface nodes have a Group field that lets you enter a named group or pattern to select the components the node should apply to. This field recognizes special syntax that allow you to select components by the value of an attribute. For example, in a Point node’s Group field, @foo>5 selects all points whose foo attribute is greater than 5.

See the section on manually specifying groups for more information.

Dictionary attributes

Since Houdini 18.5, SOP geometry supports dictionary attributes, an attribute type where each element (point, vertex, primitive/face, or the whole geometry/detail) can store a set of key/value pairs. Dictionary attributes can be used to store:

  • Complex “blind” element data, such as game engine data, or data for a foreign geometry format that Houdini does not support natively.

  • Metadata about geometry on the detail (whole geometry).

  • Parameter values of the node that creates different elements for debugging. You could even store a node network as geometry by representing nodes with points, and their wires and parameters in a dictionary point attribute. See the Attribute From Parms SOP.

You can also create a dictionary array attribute, where the attribute value is an array of dictionaries, rather than a single dictionary.

Dictionary keys are strings. Dictionary values can be strings, numbers, arrays, or a (nested) dictionary. Dictionary attributes essentially have the same data model as JSON. In fact, UI such as the geometry spreadsheet displays the contents of a dictionary attribute like a JSON-encoded string.

Currently, support for dictionary attributes is mostly in Python, VEX, and VOPs. You can manipulate dictionary attributes on geometry using VEX snippets in Attribute Wrangle, or with a Python SOP. There is also simple support for reading key values in parameter expressions.

Language

Support

VEX/VOPs

  • Use the standard VEX functions for reading attribute values to get the entire dictionary as a VEX dict type.

  • You can check for the existence of a key with hasdetailattrib using attr_name.key as the name.

  • You can bind with a dictionary attribute in a VEX snippet with d@foo (or d[]@foo for a dictionary array attribute).

  • You can use [] to index. However, VEX has return type inference, so you may need return casts to do this. (The dictionary entry is any type, but must be resolved at compile time to a specific type.) Referring to a missing key returns a zero-value.

  • VEX/VOPs has functions for manipulating dictionaries. In addition, several functions for arrays also work with dict objects. For example, len on a dict returns the number of items in the dictionary, and isvalidindex tells whether a key is present in the dictionary.

  • keys returns the dictionary keys as an array of strings. (It is not possible to have an equivalent function for values since arrays must be single type in VEX).

  • The set function lets you build up a dictionary from alternating key and value arguments:

    dict foo = set( 'key1', 3.2, 'key2', 'stringvalue');

See the documentation for the VEX dict type for more information on working with dict types in VEX.

Python

  • Use the standard hou.Geometry methods (for example, hou.Geometry.attribValue for detail attributes) to read a dictionary attribute. This will return the entire dictionary as a Python dict containing Python types (int, float, str, list, dict).

  • Since the attribute methods return a pure Python structure, once you read the attribute value you can use regular Python to manipulate the data. For example, len() to get the number of items in the dictionary, dict["key"] to get the value associated with a key, etc.

Expressions

  • You can read the value of a dictionary key in an expression with the standard functions for reading attribute values (detail, point, vertex, prim), using attr_name.key as the name.

  • If you use the string attribute functions (details, points, vertexs, prims) to read the whole attribute value, it will return a JSON-encoded string. However, there are no JSON-parsing expression functions, and limited string manipulation functions, to deal with such a string in an expression.

Tip

The Attribute Create node only creates an empty dictionary attribute. Currently, the best way to set dictionary values in a geometry network is with a Python SOP or Attribute Wrangle.

Intrinsic attributes

Intrinsic attributes are computed values derived from the geometry that you can access as if they were attributes.

Examples of intrinsic attributes

Detail

intrinsic:pointcount

Number of points in the geometry

Detail/primitive

intrinsic:bounds

Bounding box of the geometry

Primitive

intrinsic:measuredarea

Surface area of the geometry.

Primitive

intrinsic:memoryusage

Amount of memory used by the primitive.

To...Do this

See the available intrinsic attributes

  • The command line utility ginfo -I prints a list of all known intrinsic attributes.

  • You can show intrinsic attributes in the geometry spreadsheet. By default they are not shown.

    If you are viewing geometry at a component level that has intrinsic attributes, you can use the Intrinsics menu to show all intrinsics or choose the intrinsics to show in the spreadsheet.

  • The Inspect tool can show the intrinsic attributes that are available on the inspected geometry.

Use intrinsic attributes

  • In HScript expressions and VEX, use the attribute functions to read intrinsic attributes, for example:

    prim("../volume1", 0, "intrinsic:bounds", 0)
    

    (You cannot use the @ attribute shortcut to read an intrinsic in VEX wrangle snippets. However, you can use primintrinsic and detailintrinsic to read the intrinsic directly instead of using the intrinsic: prefix.)

  • In Python, you can access intrinsic attributes using hou.Geometry.intrinsicNames, .intrinsicValue(), and .intrinsicValueDict().

  • In the group syntax, you can group based on intrinsic values. For example, @intrinsic:indexorder<100

Tip

Despite the name, some “intrinsic” attributes can actually be written to, causing Houdini or Mantra to change some internal setting. For example, you can set the intrinsic:unexpandedfilename intrinsic attribute on a packed primitive.

Tip

Bounding box intrinsic attributes, like intrinsic:bounds or intrinsic:packedbounds are returned in (xmin, xmax, ymin, ymax, zmin, zmax) order.

Higher and lower precision storage

You can choose the numeric precision of attributes you create with the Attribute Create node, and/or convert attributes to higher precision types (at the cost of more memory) or lower precision types (to save memory) using the Attrib Cast SOP node.

See Attrib Cast for information on the available storage types and limitations.

Indexing and limit variables

You may see the following “pseudo-attributes” in VEX snippets. They represent the number of the current element being processed (for example, the point number), and the total number of elements in the geometry/list. See indexing and limit variables in VEX snippets for more information.

@elemnum, @ptnum, @primnum, @vtxnum

Represents the number of the current element when a VEX snippet is run.

@numelem, @numpt, @numprim, @numvtx

Represents the total number of elements in the geometry/list when a VEX snippet is run.

Common attributes

Each type of node will use certain attributes if they exist (or in some cases require them to exist), and may create/set attributes as part of their operation. See the documentation for individual nodes to see the attributes they use/set.

The following lists a number of attributes that by convention are read/written by multiple node types.

Geometry attributes

P

vector

Point position. The viewport uses this to lay out the points of the model in 3D space. You can overwrite this attribute to move the point.

On point

N

vector

Normal direction. You can overwrite this attribute to change the normal.

v

vector

Velocity. The renderer uses this attribute to know where to add motion blur. This attribute is not computed automatically, but several nodes, especially particle DOPs, can set/use it. You can add velocity to points using the Trail SOP.

id

int

A unique element ID. This is not the same as the element number (for example, the point number). This is an attribute you can, for example, assign to points to keep track of them even if the point numbers change (which can happen if the number of points change). Particle DOPs often set/use this attribute.

name

string

Set this value on primitives, such as volumes or packed primitives, to find them in code by name. Some nodes set/read this attribute.

piece

int

Nodes that break up geometry into pieces will often set this attribute so that you can tell which polygonal faces are part of the same piece. Faces in the same piece will share the same value in their piece attribute. Other nodes may use this attribute to operate on pieces.

Sizes and rotations

pscale

float

Uniform scaling factor. This is used in different ways in different places. For particle/point rendering, it controls the size of the particle/point (in world space units) at render time. For instancing, you can use it to uniformly scale the instanced geometry.

scale

vector

Whereas pscale is a single uniform scaling factor in all axes, this attribute lets you scale non-uniformly along each axis separately.

width

float

When rendering open curves, sets the line width (in world space units) at render time. If this attribute does not exist, Mantra renders the open curve as a thin line instead of a ribbon with thickness.

On point

lod

float

Level of detail. This may be used in instancing.

On detail, prim

spritescale

vector

When displaying particles using sprint images, this gives additional sprite scaling over pscale.

Default (1, 1, 1) On point

spriterot

float

When displaying particles using sprint images, this gives sprite rotation (around camera angle) in degrees.

Default 0 On point

Viewport display attributes

gl_wireframe

int

If this detail attribute is 1, the geometry always appears as wireframe in the viewport.

If this detail attribute is -1, the geometry always appears as shaded in the viewport. For guide geometry, which are normally only drawn as wireframe, this allows them to also be drawn as shaded when using any of the shaded viewport modes.

Default 0 On detail

gl_lit

int

If this detail attribute is 0, the geometry always appears without lighting. This is currently ignored for guide geometry.

Default 1 On detail

gl_showallpoints

int

If this detail attribute is not 0, all points will be rendered as sprites, even if they are connected to geometry. Normally only unconnected points are rendered. This is currently ignored for guide geometry.

Default 0 On detail

gl_spherepoints

int

If this detail attribute is not 0, unconnected points will be drawn as spheres rather than as the render properties or as sprites. gl_showallpoints can cause connected points to also be drawn this way.

Default 0 On detail

gl_xray

int

If this detail attribute is not 0, the geometry will be drawn in X-Ray mode (visible even when it is hidden behind other geometry).

Default 0 On detail

vm_cuspangle

float

Controls the cusp angle used for generating normals when the geometry does not have any normals. 180 will produce entirely smooth point normals.

Default 60 On detail

gl_spritetex

string

Specifies a texture for sprites. This is only valid on unconnected points, or if gl_showallpoints is 1.

On point

gl_spriteblend

int

If this attribute is set to 1, turns on blending when drawing sprites. When set to 0, no depth sorting or blending occurs, greatly increasing the draw performance of sprites. Turning off blending is good for opaque sprites like vellum grains.

Default 1 On detail

gl_spritecutoff

float

When gl_spriteblend is 0, discard all pixels with an alpha value less than this cutoff value. 0 discards no pixels, while 1 only keeps fully opaque pixels. Values between 0.5-0.75 are generally good for opaque sprites with antialiased edges.

Default 0 On detail

Viewport volume display attributes

The following detail attributes control how the viewport renders volume primitives. The viewport can display these primitives as fog, height fields, or isosurfaces (signed distance fields). To query this property, you can read the volumevisualmode primitive intrinsic attribute. The detail attributes listed in this section apply to fog volumes, and some of them also affect the viewport display of height fields.

A volume visualization set can have the following 4 components.

density

For fog, this component contains the optical thickness of the smoke. With height fields, this main volume should store the elevation at each voxel.

cd

The color field. This component can be used with both fog (to color the smoke) and height fields (to texture the terrain).

emit

With fog, this component contains the intensity of emission (or internal glowing). For height fields, this component acts like a visualization stencil - the viewport only draws parts of the height field where the emit value is at least 0.5.

emitcd

This component can be used with fog volumes to color the internal emission.

The * in the attribute names in this section can be one of the above 4 strings. You can use the Volume Visualization SOP to set or modify these attributes.

volvis_*field

string

Name of the volume containing data for the respective component.

volvis_*range

vector2

Range of volume values that gets remapped to the 0..1 range.

Default [0, 1]

volvis_*ramp

string

Contains a string representation of the ramp that remaps the respective volume values. If no string is present, no ramp is used to remap the values.

volvis_*rampperiodic

int

Flags how the ramp is applied to the remapped volume values. When set to 1, the ramp is evaluated at the modulus of the volume’s value with 1. This can be useful to create a checkerboard or striped effect to better see large ranges of values.

volvis_maxres

int

Limits the visualization resolution of volumes. When set to a positive value and the volumes are high resolution, the volumes are resampled to this size before rendering.

Default -1

volvis_emitscale

float

Acts as a multiplier for emission intensity. Higher values increase the brightness of the internal glow (for example, the flames in a fire).

Default 0

volvis_shadowscale

float

Controls the intensity of self-shadowing from all light sources. Larger values result in darker self-shadows.

Default 1

volvis_ambientshadows

float

Controls the intensity of self-shadowing from ambient light sources. Note that the default headlight is treated as an ambient source for fog volumes.

The default value of this attribute is set by Ambient Occlusion under the viewport display options.

volvis_ambientmapsize

float

Controls the size of the occlusion map texture when shading for ambient light sources. Larger values (up to 1) are slower to shade, but produce higher quality results.

Default 0.5

volvis_ambientsteprate

float

Specifies how often the density texture is sampled when calculating self-shadowing from ambient light sources. Smaller values (down to 1) are slower to shade, but produce higher quality results.

Default 4

volvis_shadowcolor

vector

Controls the color of the shadows cast by the smoke. The complements of these values act like additional density multipliers for the light of each color (red, green, or blue).

Default [1, 1, 1]

The viewport can additionally approximate scattering of light within fog volumes. This feature is experimental and may be changed or removed in future versions of Houdini.

volvis_extinctionratio

float

Specifies the proportion of light that is absorbed by the volume (as opposed to being scattered out). A value of 1 signals that no scattering takes place. A value of 0 suggests that all light that interacts with the smoke is scattered.

Default 1

volvis_scatteringiter

int

Scattering is approximated by an iterative process, and this attribute stores the number of refinement iterations that are performed. Larger values produce more accurate results, but take longer to compute.

Default 25

When working with fog volumes, you can force the viewport to instead draw its motion vectors or normals. This behavior is also controlled through detail attributes.

volvis_motionvec

int

The viewport will draw screen-space motion vectors for the fog when this attribute is non-zero. The vel vector volumes will be used to read the velocities.

Default 0

volvis_normals

int

The viewport will draw screen-space normals for the fog when this attribute is non-zero. If both volvis_normals and volvis_motionvec are non-zero, the viewport will draw the normals.

Default 0

Particle attributes

force

vector

The force attribute on the current point. This is set/used by some particle DOPs. It represents a change to the particle’s position computed by adding up all the forces acting on the particle.

rest

vector

Conventional name for an attribute containing each point’s rest position, used by various nodes. Some shaders can use this rather than P, so procedural textures will stick even if you deform your geometry.

On point

torque

vector

The torque attribute on the current point. This is set/used by the Torque DOP to spin particles.

up

vector

Represents the up vector of a particle’s local space. This is used for instancing geometry onto a point. You can overwrite this attribute to change the particle’s orientation.

accel

vector

Obsolete, used by old POPs. The new DOP particle nodes use the force attribute instead.

backtrack

vector4

Obsolete. Used by old POPs to store the particle’s previous position.

orient

vector4

Quaternion orientation of a particle. Allows fully specifying rotation, whereas up only orients along a single axis. If this exists, it is used for instancing geometry onto a point.

rot

vector4

An additional offset-quaternion applied after all other attributes, used when instancing geometry onto a point.

nextid

int

Detail attribute storing the largest particle ID, allowing Houdini to create new particle ids efficiently.

pstate

int

A bit field encoding different pieces of information about a particle’s state (for example, whether it is alive, whether it is stopped, whether it collided in the previous frame, etc). Various particle DOPs read and write this attribute.

The pstate value is the sum of the following flags:

0x01

Is a “primary” particle (not birthed from an existing particle).

0x02

Will die before the next frame.

0x04

Stopped.

0x08

Has collided.

0x10

Stuck to static or moving geometry.

0x20

Is associated with a rigid body dynamic simulation.

0x40

Active.

0x80

Motion is overridden by a CHOP.

Shader overrides

Most shaders will use the override attributes to change how elements with these attributes are shaded.

Cd

vector

Diffuse color override. The viewport uses this to color OpenGL geometry.

Alpha

float

Alpha transparency override. The viewport uses this to set the alpha of OpenGL geometry.

Cs

vector

Specular color override.

Cr

vector

Reflect color override.

Ct

vector

Transmit color override.

Ce

vector

Emission color override.

rough

float

Roughness override.

fresnel

float

Fresnel coefficient override.

shadow

float

Shadow intensity override.

sbias

float

Shadow bias override.

Rendering attributes

uv

vector

The UV coordinates of the point/vertex. The first two elements of this vector contain the current U and V coordinates. Note that uv is Houdini’s conventional attribute name for storing texture coordinates. You can store texture coordinates in other attributes and have multiple UV layouts on the same geometry. Most texture-related nodes have a field to let you specify the name of the UV attribute to use.

On point, vertex

material

string

The node path to the material to use to shade this primitive. Overrides the object’s material.

instance

string

The instance attribute on the current point, containing a path to the geometry instanced on the point. This can be a file path to a geometry file, or an op: path to a geometry object or node. You can overwrite this attribute to change the instanced geometry.

On detail, prim

rishade

string

Detail/primitive. The name of a RenderMan shader.

On detail, prim

See also

Geometry

Understanding

Modeling

Terrain

Fracturing

  • Destruction

    How to break different types of materials.

Clouds

Next steps

Guru level