2
$\begingroup$

I would like to offset the texture for each of the moving circles created with Geometry Nodes so they do not all look identical. I thought this could be done with the initial starting coordinate of each circle, but I cannot find a way to make use of this in the Shader. enter image description here This is the Geometry Nodes set-up: enter image description here

Things I have tried:

  • I tried to use Capture Attribute (and also Store Named Attribute) with the initial positions, just after the Distribute Points on Faces node. But they always get lost, either because the values end up being 0 or because they are not stored in the instances (or final meshes) that come out of the Geometry Nodes. I tried to use it in the Shader like this, for example:enter image description here

  • I found the following which seem relevant, but could not work out how to adapt them properly to my use case which includes animation. https://blender.stackexchange.com/a/254677/156592 https://blender.stackexchange.com/a/245919/156592

  • I also tried Mesh Islands and was thinking I could use their index, but they seem to combine several circles when they are overlapping

  • I tested to use Random output of the Object Info node in the Shader, but that makes it flickering. The offset seems to change per frame rather than being fixed for each circle.

I am new to blender, please apologise if terms are used incorrectly and if I got concepts wrong.

$\endgroup$

1 Answer 1

1
$\begingroup$

In the setup below, I'm capturing Random Values on the instances at the very end of your nodetree, and using those values to first add to and then rotate the generated image mapping vector. Since Store Named Attribute is set to the Instance domain, Attribute node in the shader should also be set to Instancer, instead of the usual Geometry you use with meshes:

enter image description hereVector Rotate, is of course, optional. I'm capturing a random value between $0$ and $6.2831...(2\pi)$ so we get a nice radial distribution

That's rather easy, however it seems to go a bit haywire when you play the animation:

After looking at the setup for a bit, I've come to the conclusion that this was due to how the circles are instanced on the endpoints of the curves that are getting trimmed at every frame. A sphere gets instanced at the endpoint and gets a randomly mapped texture. Curve gets trimmed. A new sphere gets instanced at the new endpoint and gets a new texture. And so on and so forth... This is my guess, but it is pretty likely what's going on. So, I changed how spheres get created: we want to create them once and then move them around—instead of creating new points that move around and instancing on them.

Convert the circle to an instance at the very start, with a Geometry to Instance, then make copies of it with Duplicate Elements set to Instance. To ensure there are as many instance copies as we have curves, use the Spline Count from a Domain SizeCurve. We want to place them at the curve endpoints, so using a Sample Curve at Factor: $1$ get the Position of the endpoint and move the instances there with a Set Position:

enter image description here

$\endgroup$
6
  • $\begingroup$ Many thanks for your answer! There are really good pointers like the explanation of when to use Instancer and when to use Geometry in the shader or the pointer to the domain size node. Also, thank you for providing an explanation how the changes you made to work around the instancing problem work. This makes sense. $\endgroup$
    – ikkjo
    Jan 16, 2023 at 21:07
  • $\begingroup$ The random value you store in the output sequence achieves the goal of offsetting the texture and is likely all I need. Since I struggled with this problem so long, I need to ask, is there a way to store the original point positions in the output instances, similarly to the random value? I guess this would transfer it from the path instances to the moving circle instances, would you know how this can be done? $\endgroup$
    – ikkjo
    Jan 16, 2023 at 21:10
  • $\begingroup$ @ikkjo Depends on which points you mean maybe, but in general you could use a Sample Index (or Sample Curve, if that fits) for the "Position" value (like I do in my screenshot) and feed that into the Store Named Attribute at the end? $\endgroup$
    – Kuboå
    Jan 16, 2023 at 21:16
  • 1
    $\begingroup$ @ikkjo You can sample from the beginning like this: i.imgur.com/8ucMVUB.png (I grouped everything in between in a node for simplicity here) Don't forget to switch the Store Named node to "Vector". If this post answers your initial question (texture randomizing) then can you "accept" it please? Thanks $\endgroup$
    – Kuboå
    Jan 16, 2023 at 22:04
  • 1
    $\begingroup$ Great! Thanks a lot for your help and for the added explanation for the follow up quesiton! $\endgroup$
    – ikkjo
    Jan 16, 2023 at 22:20

You must log in to answer this question.

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