6
$\begingroup$

I am trying to pass a geometry nodes output attribute (an integer) to the shader editor to control the offset of an image sequence. I have succesfully done this to pass the attribute and change , ie: the color in the shader. But, As the image sequence offset does not have an input... I have tried to do so using Drivers... but I am missing something about how to pass the attribute to the frame offset I havent found any answer searching.. any help? regards enter image description here

$\endgroup$
5
  • $\begingroup$ I have managed to pass the value of the output from the Group Output (an integer) by copying the Drivers and pasting in the shader editor (bpy.data.node_groups['Geometry Nodes'].nodes['Group Output'].inputs[2].default_value ). BUT, this only udates the value if I change the value manually in the within geonodes. If I plug the valur to another integer socket that changes , then it does not update.... ¿Why? $\endgroup$ Commented Jun 2, 2022 at 7:28
  • $\begingroup$ Image sequence offset is the same for all shader pixels, you cannot use a different image for different parts of the surface (that's why the value is not a socket). If you need that, a better option would be an image atlas and offsetting UVs. If you just want a single image and drive the offset with GN, you could encode the value in a vertex position, use an Empty with a location constraint, add a vertex group to make it follow a single vertex. The Empty location can then be the input for a driver in your shader node, extracting the offset value again. Convoluted but it works. $\endgroup$
    – user436
    Commented Jun 2, 2022 at 8:53
  • $\begingroup$ I just want to change the whole image for the whole object using the sequence. What I dont understand, is why it works if I insert by hand the FRAMES value in the group output, and it does not work if I use an integer node or any other variable node. $\endgroup$ Commented Jun 2, 2022 at 9:15
  • $\begingroup$ When you read the value from the group output node it's a fixed number in the node tree, whereas the geometry nodes output is a (temporary) mesh. You can't get the result of the nodes math from the node tree itself. It's like the difference between reading source code and actually executing that code. I'll see if i can make a quick example for using the node result in a driver ... $\endgroup$
    – user436
    Commented Jun 2, 2022 at 9:22
  • $\begingroup$ Ah.. curious.... so.. how to pass a value? I have tested a similar setup to pass the color and a material to the saher and it works.... difficult to get the concept. Thanks $\endgroup$ Commented Jun 2, 2022 at 9:36

1 Answer 1

8
$\begingroup$

How to expose geometry nodes result as driver inputs:

  1. Compute some value in geometry nodes. In this case it's going to be a frame offset, so I calculate some integer number.
  2. The mesh only has a single vertex. You could output multiple values in different vertices, but for simplicity I'll stick to 1 vertex only.
    enter image description here
  3. Add the mesh vertex to a Vertex Group.
  4. Add an Empty object. This will be the thing that the driver can actually use.
  5. Add a Copy Location constraint to the Empty. Set the single-vertex-mesh as target and the vertex group. Now the Empty will follow the position of our single vertex, which in turn encodes the frame value we want to output.
    enter image description here
  6. Finally add a driver to the image sequence node as before. Use the Empty object's X position as the driver variable. Now you can change the values in geometry nodes, the Empty will follow the vertex position, and the driver will change the sequence offset accordingly.
    enter image description here
$\endgroup$
1
  • $\begingroup$ Thank you. I willstudy this setup and try with mine. Thanks $\endgroup$ Commented Jun 2, 2022 at 10:16

You must log in to answer this question.

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