The Attribute node is responsible for creating attributes (variables) and manipulating them.
The first input can receive fibers, particles or meshes, and the attribute created will continue forward in the graph. The second input can receive Grooms strands or Guide Sets, so their attributes can be passed to the newly created variable.
In this tutorial, the term variable is equivalent to the term attribute.
Using the $ symbol before variables is optional in recent versions of Yeti, and it understands the variable either with or without this symbol.
The first field called “Attribute” is the name of the attribute to be created or modified. If it does not exist, it will be created automatically. This name cannot contain spaces and is case sensitive, meaning that it differentiates lowercase letters from capital letters. It is not allowed to start the name of an attribute with a number, such as "1myAttribute". Numbers can be used normally except at the beginning, like "myAttribute1".
The second field called “Default” is the initial value that the attribute will receive when created or value that will be overridden in the attribute if it already exists. Your Attribute Type can be Float or Vector.
The new attribute can then be used on any node after it and in any field. It can be used to control the bend value of the strands or their thickness, for example.
Example File: Attributes_Default.ma
“Detail Type” specifies what type of data detail the attribute will have. Uniform is the standard used for fibers. Other types will be covered in this tutorial will the future when they are needed.
When the “Sample Groom” option is turned on, a Groom attribute with the same name used in the “Groom Attribute” will be used. It uses the Groom connected to the second input of the node. This value will be multiplied by the “Default” field and will result in the final value of the created or modified attribute.
Example File: Attributes_Groom.ma
Mapping Attributes for Rendering
In the second tab of the Attributes node, Mapping is where attributes are transferred to a format in which the renderer will understand and so you can use them to color or create masks for the Shader. Each renderer has its own node for interpreting Maya plugins or internal variables. In VRay, these nodes are called “VRayUserScalar” for Floats and “VRayUserColor” for Vectors. In Arnold, they call “aiUserDataFloat” for Floats and “aiUserDataColor” for Vectors.
To map a variable for the Render, enable the “Map as Renderable Attribute” option and place the name of its attribute in the two fields below it. This name will be used on the node that interprets render variables, as described above. If it fails to identify the variable, its default value will be used. One way to check if the variable is working is to just change the default value of this node and see if a change occurs in the Render. If it does, it's because it failed to find the variable. In this case, make sure that everything is spelled correctly and that both the Yeti and Renderer versions support this function.
Example File: Attributes_to_Rendering.ma
Creating Geometric Attributes
In the Geometric tab of node Attributes, some internal attributes related to the fiber properties can be created. They are very useful in specific cases that will be dealt within this document in the future. The attributes that can be created are:
Root Position: Creates an attribute called “root” that will have a value for each fiber relative to its position P in space. Since the vector P is formed by a position in [X, Y, Z], these coordinates can be interpreted as a color [R, G, B] and used in the Shader.
Tangent: Will create a vector tangent to the normal of each fiber. It is very useful for guiding instances and feathers. The Normal vector N is a vector of direction [x, y, z] that is perpendicular (forms an angle of 90 degrees) with the surface.
If we negate vector N, we invert the direction of its Normal. The Tangent vector is an auxiliary direction vector that is perpendicular to the vector N and follows the surface.
The Tangent Bivector is another auxiliary direction vector orthogonal both to Normal and Tangent. Yeti does not automatically create this Bi Tangent vector, but it can be reproduced with the Dot Product function between the Normal vector and the Tangent vector.
Face Index: Creates an attribute called “faceindex”, which contains the face number of the polygon of the mesh that each fiber is attached.
RiCurve Basis: RenderMan's unique attribute, which tells which curve interpolation should be used by the renderer.