# Geometry Nodes: How to iterate a Vertex Color gradient across geometries?

I want the geometry I create in Geometry Nodes to be generated with a Vertex Color gradient that I can use in the object's material.

In this example there are several rectangles, one original, and three more generated at each iteration of the Node Group.

Here's the inside of the Node Group:

As you can see, it's not really doing anything special in its current state. Just recursively creating a new transformed rectangle in each iteration. Brightness is supposed to get added in each iteration too, to step from black (0.0) to white (1.0), but this is not working.

In order to match the example I manually painted, the grayscale values should instead be approximately 0.0, 0.33, 0.66, 1.0.

The other (possibly greater) problem, is that despite being a property of vertices, vertex color appears not to be uniquely linked to each separate island of geometry.

If anyone knows how to do this, please share. I would like to access gradients from mesh vertices within my material, instead of having to make a separate material for each island of geometry. Thanks!

Example .blend file (Made with Blender 3.0.1)

There are a few small problems in your node tree:

• your inputs and outputs are pink (= boolean) but you want to store Fac, which is a float. Boolean are either 1 or 0. No other value.

-> also inputs and outputs of your group node have to be changed

i hope/think, what you want is that?

result:

• Thank you! The result is looking good! Is there also a way to do this using the Join Geometry node? Or is it only possible using Instance on Points? Because although I kept my example simple, what I ultimately want to do will involve more complex geometries, and I was planning to join them. Commented Mar 3, 2022 at 4:21
• You are welcome. I am not sure whether i understand you right. Of course you could do a "join geometry" at the end of my tree - it would work. Or do you mean something different? Commented Mar 3, 2022 at 4:26
• i have no idea now, how it should work because then you would have only one mesh which you cannot "separate" as you can do it with instances. I am sorry. Maybe some other GN pro's know how to do that. Commented Mar 3, 2022 at 4:41
• I've been playing with different node setups. I feel like I'm close. Could you please take a look at my .blend? Join is working, but the gradient is spread across the vertices, without treating each iteration of geometry as having its own "step" value. Maybe the ID Node could be the key? Commented Mar 3, 2022 at 6:09
• maan I just wanna thank you from the bottom of my heart cuz I am doing a light strip with all the individual led controlled by a color ramp and I couldn't find a way to translate the color ramp color to the leds (I just started guessing it prob had smt to do with the index) and after searching for days - I found your answer now and it's the exact solution. Thank you!!! :'D Commented May 9, 2023 at 7:53