My doubt is pretty straight forward:
I have geo nodes grid with a bunch of instances with randomnized height.
I want to colorize each instance depending on their height.
I know that I need to somehow associate the index of each instance with it's Z position and apply a color ramp on that or send it as attribute to shader editor, but I don't know how to do it, can somebody help me please??
Here is a concept of what I'm trying to achieve:
To do this shape I got a bunch of curve circles, transformed to points and instanced cubes with random sizes upon them.
Thx!
-
$\begingroup$ In principle this is not a problem, but it depends very much on how you have structured it. The height of an instance cannot be read in GN. But if you create/scale the parts with GN, then you have somewhere also the value for the scaling. Can you share your blend file with us? blend-exchange.com $\endgroup$– quellenform ♦Jun 30, 2022 at 19:11
-
$\begingroup$ Sure! but how do I do it? btw, I'm building random scales , therefore with geo nodes. $\endgroup$– Guilherme Schönmann FinardiJun 30, 2022 at 20:06
-
$\begingroup$ If your question has been solved, please be so kind and mark the answer that contributed to the solution as "Accepted answer" so that this question will not continue to be displayed as unsolved. Thank you! Here you can find more information: What should I do if someone answers my question?. If you still haven't gotten a solution to your question, please be kind enough to address it. $\endgroup$– quellenform ♦Oct 24, 2022 at 9:27
1 Answer
"How can I colorize each instance depending on their height?"
In principle you store your randomly generated value for the scaling in a Named Attribute (In Blender 3.2 directly via the node Store Named Attribute
and in lower versions via Group Outputs).
You can take this value in the shader with the node Attribute
and put it into a ColorRamp
.
Of course you can also create and store your colors directly in Geometry Nodes in the same way.