0
$\begingroup$

So what I am trying to do is displace an array of points based on location of another object. The nodes work well, when I "call" each object seperatly using "Object info node". But I need to "call" a lot of objects and the nodes are starting to look unorganized.

(working nodes) I start by generating a point grid, the displace points node is basically just math that uses x,y values of the point array and X,Y location of the object to offset the z component of point grid. Then i use instance on points to generate a grid of cubes on which i apply a material. (working nodes) I start by generating a point grid, the displace points node is basically just math that uses x,y values of the point array  and X,Y location of the object to offset the z component of point grid. Then i use instance on points to generate a grid of cubes on which i apply a material.

I get this result. enter image description here

(doesn't work) So I want to replace the repetition by using a "collection info node", but cant seem to make it work. (The objects in collection are all single vertex objects to make it simpler). Essentially I want to iterate over each object in selection and apply the linear transformation "displace points node". I manged to make it work using transfer attribute using index mode, but it only applys the transformation for that index. If I use nearest values don't overlap correctly. nodes don't work

$\endgroup$
3
  • $\begingroup$ It would be possible to reference a collection, but it wouldn't simplify your nodes whatsoever. Think about it: you'd still need to specify which bit of the collection you wanted for that particular node group input. And you're using a single node for that right now, Object Info. You're not going to make anything that specifies which bit of a collection to use that takes fewer than one node. $\endgroup$
    – Nathan
    Feb 2 at 22:20
  • $\begingroup$ So there is no way to apply transformation for each instance in collection, without copy pasting the "displace points node". There is no way for me to iterate over an array of vectors, that are used as a math input to get the displacement for each input vector and than just summate over each iteration? $\endgroup$
    – jst kiko
    Feb 2 at 23:38
  • $\begingroup$ Do you just want to summate? You can do that: instance the points as a collection, use attribute statistic node to get the sum of their positions. Do you want to do some specific thing with/to each point in the collection? Then you need some way to identify each specific point, and connect it to the specific thing you want to do with it. $\endgroup$
    – Nathan
    Feb 2 at 23:46

1 Answer 1

1
$\begingroup$

If you just want the sum of positions, you can do that:

enter image description here

Here, I'm transforming the cube by the sum of the positions of point objects in a collection.

If you want to do something specific with each vector, then you need a way to reference which vector you want to do it with, and there's nothing simpler than doing that with a single node per specific thing you want to reference, which you're already doing.

$\endgroup$
6
  • $\begingroup$ Sorry I wasn't very clear, the way i see it the position of points that comes out of "Grid node" is an array of positional vectors with length (vetreces X * vetreces Y), and I have another array of positions of each object in collection with length (number of objects). so is it possible to generate an array of arrays of vectors shaped (number of objects, vetreces X * vetreces Y) where each vector is the displaced value that comes out of the "displace point node" for a given vector input. $\endgroup$
    – jst kiko
    Feb 3 at 9:13
  • $\begingroup$ Example: array[0] has len(vetreces X * vetreces Y) and house values after being displaced baste on first object in collection, array[1] houses values after being displaced by second object ect. Then i want to summate these array so i get an output array that is len(vetreces X * vetreces Y) which houses values of the summation of all displacements of a certain grid point. Then i can use this with "set position node" to get the result I wanted. If you have an idea how to do something like that it would be great, I ll figure the specifics myself. $\endgroup$
    – jst kiko
    Feb 3 at 9:20
  • $\begingroup$ Arrays aren't 2D, they aren't arrays[x][y]; they are 1D arrays[index]. An array of arrays is instancing geometry, 1 per point, which can be done; that would not be the same as serially displacing, it would be displacing multiple copies in parallel with each other. You can capture info from an instancing point (its position is captured implicitly, but you can undo that.) I think it's hard to gather your actual goal from the question and these comments, and that you should consider linking a file that demonstrates what you want to do-- not overly simplified. $\endgroup$
    – Nathan
    Feb 3 at 15:43
  • $\begingroup$ I added some clarification but after some playing around I think I posted the wrong question. A better question would be is it possible to use "while loops" in blender nodes or how to get around using them. $\endgroup$
    – jst kiko
    Feb 3 at 16:10
  • $\begingroup$ Just saw your edit. No, I don't believe you can do this more simply in GN than you are already doing it. In general, higher-level questions-- "How can I most simply get this effect"-- are much better than lower-level questions-- "How to make a while loop"-- because the answers depend so much on the details. $\endgroup$
    – Nathan
    Feb 3 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.