0
$\begingroup$

I am currently trying to get into Geometry Nodes. Right now I have a problem: In my scene there is a Curve object with 3 splines. It is important that the splines are not created in the geometry nodes, but already exist. Now I would like to send a separate spline as attribute for shading, so that the splines can get different colors. But I just can't get this to work.

My attempt looks like this:

enter image description here

enter image description here

Can someone help me?

$\endgroup$
1
  • $\begingroup$ I am sorry but I don’t know what attribute you want that should change what value in your shader?! $\endgroup$
    – Chris
    Apr 7, 2022 at 12:13

1 Answer 1

2
$\begingroup$

First, indexes start with 0, so first spline will be #0 and #1.

Second, if you are using capture attribute, set the type to "spline" (not "point")

3rd, index in spline parameter returns indexes of points in the spline, not useful then you want to get index of spline, use Index node instead.

4th, Capture attribute should be connected to the output before curve to mesh node. In that case, you will get the indexes of spline before they will be converted to mesh.

And at last but not least, you have to make an attribute to save data:

enter image description here

Then you will be able to use it in shader editor.

This is a final setup:

enter image description here

$\endgroup$
6
  • $\begingroup$ Thanks for your help. But how can I select an index? I have now changed Capture Attributes to Spline, but I can't isolate a spline with the shading.... I thought the Math Node with Less Than would select the index under 2. $\endgroup$
    – Andi
    Apr 8, 2022 at 7:15
  • $\begingroup$ I see now, it's because capture attribute is not connected to output. Put it before convert to mesh $\endgroup$
    – Crantisz
    Apr 8, 2022 at 7:35
  • $\begingroup$ But when I do that, the mesh around the curve also disappears. It is also not possible to have 2 outputs. $\endgroup$
    – Andi
    Apr 8, 2022 at 7:47
  • 1
    $\begingroup$ @Andi I have updated the answer. $\endgroup$
    – Crantisz
    Apr 8, 2022 at 9:11
  • 1
    $\begingroup$ @Andi spline parameter gives you an index of point restarted from 0 in each spline. Using capture attribute with spline setting will give you 0 every time. $\endgroup$
    – Crantisz
    Apr 8, 2022 at 9:48

You must log in to answer this question.

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