1
$\begingroup$

Using geometry nodes, I set up hexagons to move up and down in a sine wave pattern as the scene moves through time. Then, I added noise as an offset, to vary the hexagons' height as they move up and down the sine wave. When assigning color to the material, I'd like the color to come from the hexagons' height, but only their heights from before I added the noise offset in the geometry nodes graph. Right now in the shader nodes editor, the "Object Info" node's Location value is outputting the final location, after the geometry is offset by noise. Can I get the pre-noise location to drive my shader color?

Edit: Capture attribute doesn't seem to be working the same way as one answer shows. I'm posting screenshots and my file for reference. I'm using Blender 3.1 :

Geometry Nodes Shader Nodes Material Preview

$\endgroup$
1
  • $\begingroup$ Try to use Transfer Attribute node. $\endgroup$
    – NatureK
    Commented Mar 13, 2022 at 5:52

1 Answer 1

2
$\begingroup$

this node setup does what you want:

enter image description here

shader setup:

enter image description here

modifier:

enter image description here

enter image description here

enter image description here


to answer the question in the comment, how to setup the shader that the top part is white and the bottom part black:

enter image description here

you can use a colorramp and the generated texture coordinate z for that. Together with a math node (greater than) you can determine which color should be chosen.

You have to mute the "realize instances" node in GN to make that work.

--- UPDATE on next comment:

you can use this shader node setup:

enter image description here

and adapt the GN node tree like this:

enter image description here

enter image description here

to get this:

enter image description here

$\endgroup$
9
  • $\begingroup$ Thank you. I tried using your same node setup using Capture Attribute, but it doesn't seem to work for me. I'm using Blender 3.1. Instead of using noise, I'm using an empty whose Z transform is baked from sound files (for music visualization). Perhaps I should upload my file? $\endgroup$
    – CPLTarun
    Commented Mar 13, 2022 at 22:03
  • $\begingroup$ If you want me to take a look : yes $\endgroup$
    – Chris
    Commented Mar 14, 2022 at 5:54
  • $\begingroup$ Much appreciated. I edited my original question with three screenshots of my setup, as well as a blend-exchange link to my file. $\endgroup$
    – CPLTarun
    Commented Mar 15, 2022 at 0:24
  • $\begingroup$ you have set the output to instance, set both to point and it works [6]: i.sstatic.net/hHcz2.jpg [7]: i.sstatic.net/Rl5Ko.png if my answer helped you, please click on the checkmark left to my answer. thanks. $\endgroup$
    – Chris
    Commented Mar 15, 2022 at 7:45
  • $\begingroup$ Thank you so much Chris! One last thing I wanted to ask is, is there a way for the color of each hexagon to vary along it's height? As in, if the center of a hexagon prism was at z = 0, could the top part (where z > 0) be in one color like white, while the bottom part (z < 0) be in black? $\endgroup$
    – CPLTarun
    Commented Mar 16, 2022 at 2:43

You must log in to answer this question.

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