Attribute From Pieces

The Ultimate Houdini node reference

Visit the Node Bible

To learn more, please log in or sign up for free to explore the Node Bible.
Write your awesome label here.

Attribute From Pieces

Write your awesome label here.
The Attribute From Pieces SOP is part of a workflow that involves copying geometry to points.  More specifically, this node is responsible for selecting which pieces get selected when instancing them to points.
Drag to resize


To use this node, plug the first input into the points that you're copying the object to.  In the second input, plug in the geometry that's going to be instanced onto the points.  See the diagram below for a visual representation of how to set this up:
This node is designed to work hand-in-hand with the Scatter Align SOP. The Scatter Align's job is to prepare the attributes on the copied points that deal with the rotation and scale of the instanced objects. It does not, however, select which piece of geometry will get instanced. The job of the Attribute From Pieces SOP is to help in selecting which piece goes to which point when instancing. In practice, this is nice because it allows for a variety of ways to randomly select pieces when they instance to points.

This node may also work well with the Sort node because many operations will rely on point IDs.

Drag to resize

General Parameters:

Piece Attribute:

-- As mentioned above, this node is trying to select which pieces go to which points when instancing. It does this by matching this “piece” attribute on the points with a piece attribute that’s on the instanced geometry. The important thing to remember here is that the piece attribute must match what is assigned to the separate pieces of geometry.

--  NOTE:  This node seems to be very picky about whether or not the piece attribute is a point or primitive attribute.  In practice, I have found that it works best when you define a primitive attribute that gets used for matching pieces to points.  If you have both primitive and point attributes, this node seems to not work properly.

Piece Filter:

-- This parameter is optional. If you want to only consider certain piece values when making a section, you can specify so here. As an example, let’s say that you had a piece attribute called “name” on three rocks. The value of the name attributes on those rocks are, “rock001” “rock002” and “rock003” Now, lets say that you don’t want to use “rock003” because you’re only interested in instancing “rock001” and “rock002” If that’s the case, then you can use this piece filter to isolate rock001 and rock002 by saying “rock001 rock002” This parameter recognizes different names values by adding a space between each value you’d like to consider.

Copy Attributes, Allow P Attribute, + Promotion Method:

--  In practice, I've found this settings to behave un-expectantly.  According to the docs, "List of attributes to copy from source pieces. Attributes that match this pattern are aggregated over each piece using Promotion Method before they are transferred to the output points.  Note:  Attributes are copied from the same class as Piece Attribute. That is, if the Piece Attribute lives on points, then point attributes will be copied; otherwise, the attributes will come from primitives."

--  Instead of using these parameters, I suggest using an attribute transfer node or a wrangle after the attrib from pieces if there are any attributes that need to be adjusted.


-- The mode is the primary way of determining how you’d like to instance each piece to each point.  The settings on this node will change depending on which mode you select.  As you read through the various modes below, the associated parameters will be mentioned below the corresponding image.

-- Cycle = The instanced geometry will go in order (ex: “rock001” “rock002” “rock003” etc...) and repeat as the points ascent in their point ids.  Below is an image demonstrating this mode:
This mode will enable the "Pieces" section.  Here are those parameters:

Shuffle Pieces:

--  Turn this on to randomly scramble the order of the pieces


--  This gives you a different version based on the settings you've specified


--  This will shift the order of assigned pieces forward by a certain number

-- Patches = According to the docs, "Assigns the pieces in random “splotches” (using Worley noise). That is, instead of randomizing each individual point, it randomizes irregularly shaped groups of points."
The Patches mode will reveal settings related to defining the shape of the patches.  Here's what those are:

Patch Size, Scale, and Offset:

--  Adjust these setting to change the shape of the patches.


--  Strength = how much to distortion to apply
--  Size =  Changes feature sizes
--  Roughness = Changes how much small detail there is in the distortion effect
--  Offset =  Offsets the distortion in X,Y,Z

-- Noise = According to the docs, "Assigns the pieces using noise. This is not the same as randomizing each piece. Instead it assigns a piece based on the quantization of the output of a chosen noise function. This lets you create organic-looking patterns and other effects."
--  The noise settings will follow that of any typical noise parameters you may find in 3D.  For more info about noises, I would advise following my shading techniques courses.

-- Random = According to the docs, "Assigns pieces to points randomly. You can assign weights to each piece to make some pieces more likely than others."
The Random Node also comes with its own settings under the "Random" tab, so here's what to expect:

Weight Method:

--  Uniform Distribution + Seed =  All pieces are assigned randomly without favoring any one piece over another.  The seed will give you a different version of the uniform distribution

--  Piece Weights =  This allows you to favor certain pieces over others.  Use the "Autofill Pieces" to create weights for each detected piece that's coming in from the second input.  You can then assign a weight to each piece.  The higher the weight, the more likely it is to spawn that piece relative to the others.

--  Weight Attribute =  According to the docs, "Use a primitive float attribute on the piece geometry that sets the piece’s random weighting. The weighting for a piece is the average of this attribute’s values across the primitives of the piece."  In practice, I've found that this works pretty much just like the Piece Weights does where it favors certain pieces over others based on a weight value.  For most situations, it makes more sense to use the piece weights method instead of this method, however, you can do so by assigning each instance a float primitive attribute that will act as a weight.

-- Map Attribute = According to the docs, "Assigns pieces to points based on the value of an attribute on the points."  This mode, in particular is very useful because it takes a point attribute and uses it as a seed for selecting geometry.  In practice, this can be used with the Attribute From Map node, Attribute Paint, Distance From Geometry, or the Masking nodes to select which instances get placed at certain locations.  As an example, take a look at this screenshot using the Attribute from map to select random pieces:

Here's an example of what you can do with this mode:
The parameters for this mode can be found under the "map attribute" section.  Here are those parameters:


-- This field is asking for the point attribute that gets used to determine which piece gets selected.

Attribute Type:

-- Numeric = The data used for selection is a number

-- String = The data type used for selecting instances is a string (in other words, a value which uses “words” instead of numbers like, “1,2,3”

Map Pieces From:

-- Automatic Ranges = According to the docs, “Automatically creates a mapping between equal-sized ranges of values in the attribute and the available pieces in the second input”

-- Explicit Range = This allows you to specify which piece gets assigned to which values. For numeric attribute values, you can specify a range. For String values, you can explicitly state which word gets paired with which instance.

Autofill Pieces:

--  This will create rule entries for each individual piece that’s recognized from the second input. So, if you have three pieces, it will create three rules for you to define.

Unmatched Piece:

-- If a piece doesn’t fall in range with the rules specified above, then it will assign this primitive to the point.

Unmatched Group:

-- This will group any primitives that didn’t match a rule that you specified above.


-- Provides a different version based on the rules you specified above

-- Vexpression = This mode allows you to distribute pieces based on a true/false vex statement.  See this image as an example:
You may also notice that there's an "ID Attribute" parameter that shows up when using the vexpression or cycle modes.  Here's that that does:

ID Attribute:

--  This attribute gets used to aid in deciding which point gets assigned to which instance.  Normally, the point ID is used as a seed when determining which instance is selected.  This ID attribute can override that behavior.  Instead, when this is checked on, an attribute is used to determine the seed that's responsible for selecting which instances are placed as points.  As an example, if we assign an ID value of 0 on the lefthand side of the circle and a ID value of 1 on the right, this is what we will get....
Drag to resize