2
$\begingroup$

I've been following this cell fracturing tutorial: https://www.youtube.com/watch?v=keKDABQfxQU

I'd like to add a colour change based on an attribute in my geometry nodes. I'm trying to use 'Store Named Attribute' from a map range node result in geometry nodes to transfer values to my material nodes, but I'm struggling to get this working.

Here's my current set-up:

enter image description here enter image description here

$\endgroup$
3
  • $\begingroup$ The problem seems to be that the only output from store named attribute node is a geometry, this won't let me run it into the vector input on my math node (distance in the screen grab): imgur.com/a/lkh9oco $\endgroup$
    – Tumbledown
    Aug 24, 2022 at 9:00
  • $\begingroup$ If you haven't received an answer to your question that can solve the problem, please be so kind and let us know so we can find a solution. Thank you! $\endgroup$
    – quellenform
    Aug 26, 2022 at 12:14
  • $\begingroup$ Hey sorry for delay, busy week at work so haven't had chance to come back to it until now. $\endgroup$
    – Tumbledown
    Aug 27, 2022 at 18:20

1 Answer 1

2
$\begingroup$

To store certain values in a geometry and to be able to use them later in the shader, you use the node Store Named Attribute.

So that the values are really stored in the geometry that ends up at the Group Output, this node must also be attached somewhere along the green noodle, because the node stores the data in the geometry that is applied to its input and returns the geometry at the output.

In this concrete case you simply hook the node Store Named Attribute after the node Collection Info, and select Instance as domain.

This way the desired data will be stored in the instances and will be available later in the shader.


But to make this setup really work in the end, you would still have to convert the instances with the node Realize Instances and assign a material, because only this way the shader can process the geometry separately and apply the previously stored values.

enter image description here

$\endgroup$
2
  • $\begingroup$ This worked perfectly though in practice I found the set material geometry node didn't really add anything (plus it made the inner surfaces the same material as the outer which I didn't want). $\endgroup$
    – Tumbledown
    Aug 27, 2022 at 18:21
  • 1
    $\begingroup$ @Tumbledown You could additionally decide via the vertex group to which faces the material should be applied with Set Material (Selection input). $\endgroup$
    – quellenform
    Aug 27, 2022 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .