Version 3.1.
Setup
I'm trying to follow different tutorials where objects of random colors are placed at the vertices of another object. According to this tutorial, this can (must?) be done this way:
- Create instances of the object to be placed at the vertices.
- Embed a custom color value in the geometry data, so it can be read by the shader when rendering the instance.
- Use a
Capture Attribute
node to inject the attribute value on instances. - For some reason the attribute added to the instance will be lost prior to be read by the shader (explanations found are not very clear), so instances must be realized into simple geometry.
This tree just does that:
Now this is not the end of the story, the Capture Attribute
node is indeed set to add the value to each instance (as highlighted in green above), but as instances will be removed and converted into simple geometry, the values has to be attached to some other geometry entity. A point which wasn't clearly explained in the documentation/tutorials I used. After some (painful) experimentation, I now assume the element to be used for attaching the value is defined partly in the Group Output
node and partly in the Geometry Nodes
modifier. E.g. this setup will add the color to vertices (points):
with the name InstanceColor
:
(CubeColor
, the name of the socket is not used). And looking at the spreadsheet view, the value is actually found at the right place:
To reuse the attribute value in the material/shader, the right name has to be used (another point which was missing in the documentation/tutorials I used):
Questions
This quite long introduction to explain what is my limited knowledge of geometry nodes and attributes and this is still confused. Could someone help in explaining:
The reason the
Capture Attribute
node has to be connected to the socket of theGroup Output
. After all values are injected into the instances, using theGeometry
, so why using the socket.The reason the name to be used to store the attribute in the instances is defined in the modifier parameters rather than in the
Capture Attribute
node. The node is already used to define the element where to store the value (Point
,Instance
, etc)The reason there are two default values for the attribute, what is the use of the one found in the side panel, it seems unused.
The reason instances must be realized.