4
$\begingroup$

While trying to recreate my answer here with geonodes: Array + Curve + Subdiv anomaly

I came up with this geo nodes setup:

The strategy is to set a "flag" A, represented by the top frame, if it's the back face and the first instance, or flag B (middle frame) if it's a vertical (back or front) face and it's a middle instance, or flag C (bottom frame) if it's the front face and the last instance. Then, if either flag is set, remove the currently evaluated face.

It doesn't work, however, because instead of the instance index, I use the face index. To my understanding, the Index node gives the index of the currently evaluated element, which is a face, because those nodes are evaluated by Delete Geometry node, which is set to iterate over faces. I'm not even sure if Instance on Points is iterating - i.e. if each instance can be different (other than using a collection and passing indices...). So does it mean I have to move the logic after Realize Instances node, somehow capture the point index (or use modulo...) and then delete faces? Perhaps makes sense, but the question remains: can the index further down the chain be accessed?

I tried to capture attribute between Mesh Line and Instance on Points, and pass that back to the frames, but it didn't seem to work - I have no experience in geonodes though, maybe I was debugging incorrectly.

$\endgroup$
2
  • $\begingroup$ Hi, @Markus! Is your question specifically about transferring the index from instance to geometry, as in the title? .. otherwise, you could think of a more general 'Capped Array' method than this.. $\endgroup$
    – Robin Betts
    Commented Dec 14, 2021 at 9:46
  • $\begingroup$ @RobinBetts I'm all ears. :) $\endgroup$ Commented Dec 14, 2021 at 9:51

2 Answers 2

3
$\begingroup$

If your question is not particularly about capped arrays, but about transferring attributes from instancers to realized geometry in general, then I think this answer might be relevant?

If your question is about capped arrays, then I think it might be simpler and more general to dodge the bullet of transferring attributes altogether, and use the bounding box of existing geometry to control the location of new elements, or vice-versa.

OK, you can make an X Array group, to produce a no-gap array of elements along the element X-axis:

enter image description here

And you can make an X-Append Geometry group, which adds given Geo. to the positive X-end of existing Geo., lined up along X by bounding-box, so, again, there is no gap:

enter image description here

You can set up an interface for use with external geometry:

enter image description here

.. which I think is more convenient than the Array modifier's capping system; you don't have to adjust the X-location of the cap meshes so they fit. The GN looks up the bounding boxes for you:

enter image description here

Looking at your example of GN-generated boxes, the same groups could be used, something like this:

enter image description here

$\endgroup$
3
  • $\begingroup$ ..and you can pipe the groups together to make more exotic combinations of elements, without worrying about their x-lengths, or where the element origins lie on their x-axes. $\endgroup$
    – Robin Betts
    Commented Dec 14, 2021 at 20:39
  • $\begingroup$ The idea was to avoid using other objects, but your last solution with custom groups is much more elegant, I need to develop my collection of custom groups (or copy-paste yours!). $\endgroup$ Commented Dec 14, 2021 at 21:32
  • $\begingroup$ @Markus Sure, I just used the external geo to illustrate.. a line of boxes is not very spectacular :D.. I expect you'll want to tweak the 'capped array' group to adjust the position of the mesh relative to the object-origin . I wasn't sure where you would want it. $\endgroup$
    – Robin Betts
    Commented Dec 14, 2021 at 21:36
2
$\begingroup$

I just tried using your blend file, and with a little adjustment and modification, it works fine for me.

The strategy is to set a "flag" A, represented by the top frame, if it's the back face and the first instance, or flag B (middle frame) if it's a vertical (back or front) face and it's a middle instance, or flag C (bottom frame) if it's the front face and the last instance. Then, if either flag is set, remove the currently evaluated face.

I think your strategy at the beginning worked fine and probably something went wrong during the process of combining different boolean values that led to the inaccurate result when deleting faces.

It doesn't work, however, because instead of the instance index, I use the face index...

For me, using the faces' indices (instead of the instances' indices) in this case makes more sense since instances are only copies of the mesh, they don't actually hold any information/data of the mesh's components (points, edges, faces, etc...). So if you use its indices, I don't think there's actually any proper way of telling Blender to correctly delete the faces.

I'd organized again the first part of your node tree. The final set-up might differ a bit from your original file since I'm using the latest 3.1 alpha build (December 14th's build).

enter image description here

$\endgroup$
2
  • $\begingroup$ What I was trying to do is to create 3 different instances, and choose the instance based on the point index. But the the noodles I ended up with didn't convince me there's a remote chance Blender could read it this way... 😁 Eventually I came up with this... I couldn't find the Domain Size you used, is it new in Blender 3.1? I think instead of using a literal value (6), one could use Attribute Statistic node for index attribute, getting max output (and then subtract 1 since the index is 0-based). $\endgroup$ Commented Dec 14, 2021 at 9:40
  • $\begingroup$ For the Domain Size node, it's new and it's only available if you're using the 3.1 alpha build (see: builder.blender.org/download). And yeah, I think you could try and use Attribute Statistic in this case also. $\endgroup$ Commented Dec 15, 2021 at 1:45

You must log in to answer this question.

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