GeometryAttributes

From Odwiki

(Redirected from GeometryAttribute)
Jump to: navigation, search

Contents

What are Geometry Attributes?

Attributes are named values stored on vertices, points, primitives, and surfaces (called entities). SOPs can assign information to various entities in your geometry. Some are predefined (see answer to the next question), while others are custom created for specific purposes. Once created, these attributes are copied from node to node.

Why are they useful?

  • Carry information with the geometry, like UV coordinates, velocity (for MotionBlur), point colour, skin/capture weights and so on.
  • These override parameters in SHOPs and VEXSops, allowing your shaders or geometry deformations to varying across the surface from point to point.

Some common attributes:

  • N(ormal) attributes
  • v(elocity) attributes
  • uv coordinates (float[2] point or vertex attributes)
  • Cd (color) attributes (float[3] point or vertex attributes)
  • pCapt attributes are for capture weights and have a special length
  • shop attributes (vm_surface/etc) for shader bindings (primitive attributes)

In general, you can create any type of custom attribute you want to attach to your geometry using the AttribCreateSOP. You can then easily retrieve this data downstream using the created local variable(s).

What are they, really?

An single attribute consist of 4 parts which we describe each in more detail below:

  • Name
  • Entity
  • Type
  • Length (number of DataType elements per Entity)

Attribute Name

The name is simply a label for the attribute. Although there are some commonly used ones, they can be named anything you wish. Spaces within the name are not allowed.

Note that although these 4 pieces of information uniquely define a particular attribute, it is generally bad practice to have attributes which share the same name but only differ in Type and/or Length. Names are case-sensitive but it's also bad practice to create attributes which only differ in casing.

Attribute Entity

The Attributes can be assigned to the these types of entities:

  • Points
  • Vertices
  • Primitives (per polygon/patch/primitive/etc)
  • Detail (per entire geometry definition ... eg. per SOP)

Point Attributes are those that are stored onto every point of the incoming geometry. Obviously, storing an attribute onto every single point consumes a little more memory than any other attribute type. Where Houdini calls it "point", other software packages may call it "vertex". A single point in Houdini can be shared by other connecting primitives.

Vertex Attributes are those that are often stored for texture on the vertex. Unlike Point, vertices of one primitive in Houdini are not shared by other primitives. See also PointVsVertex for a more detailed discussion.

Primitive Attributes are those that stored, well, onto every primitive. Each of these primitives in Houdini can be thought of as a single polygon or a spline patch if you're not as familiar with Houdini jargon. For example, say we have a polygon cube that contains six primitives (or polygons/faces) with 8 points. There would be total of six primitive attribute values (as oppose to eight). This means that Primitive Attributes are lighter on memory footprint than Points.

Detail Attributes are those that are stored for the whole geometry, and thus have the lightest memory footprint. Regardless of point or primitive count, there will only be one Detail Attribute of that name. Even though Detail attributes are not as often used, they can play a big role in studios that require Houdini geometry to fit into a specific pipeline, as if applying a tag to geometry. Local variable mapping (ie. the table that translates between an attribute's name and it's expression equivalent) is stored as a Detail attribute called varmap.

Attribute Type

The available Attribute DataTypes are:

  • float (most common)
  • vector (equivalent in storage to float[3])
  • integer
  • string (sometimes called "index" attributes)

Float attributes are single precision floating point numbers (IEEE 32-bit format).

Vector attributes are actually the same thing as Float attributes except they must be of length 3. When a float[3] attribute is defined as a Vector Attribute, then certain SOPs (eg. TransformSOP) will transform them assuming that they are normal vectors on the geometry.

Integer attributes are 32-bit integers.

String attributes mean they are a series of characters. For the technically inclined (or those interested in dealing with them in the HDK), they are stored as a lookup table / integer combination. Their attribute length is always 1 because the data stored per entity is a single integer. This integer is an index into the lookup table for the attribute. For example, say we have a string attribute per primitive. For all primitives, suppose that they are either the string "A", "B", or "C". Then our lookup table might look like this: "A", "B", "C" (in that order). Then each primitive will either have an index value of 0 for "A", 1 for "B", or 2 for "C". This lookup table mechanism is largely transparent when examining the attribute values in the Geometry SpreadSheet though as the lookup is automatically done.

Attribute Length

An attribute also has a length which says how many elements of particular type there are for each entity. For example a float[3] point attribute (like point colour, Cd) means that we have 3 floating point numbers for every single point in the geometry. All entities have the same length. For example, it is not possible to have an attribute for which some points have less (or more) elements.

See Also

© 2009 od[force].net | advertise