Group Attribute Statistics Node

What i wanted to do since this discussion was to build an group attribute statistic node on the basis of the group-sort node (can be found in this blend-dev-post) from Christophe Mermoud.

(EDIT: Christophe gave me the also hint that the new topology nodes have a build in search functionality that can be used. So i spend some time to rebuild the group search on top of that. What significantly increased the performance (EDIT OF THE EDIT: meanwhile it uses the faster method from Lukas Tönne for min/max calculations without the need of sorting. sorting still used for mean though))

Without the help of the community this would not have been possible.
Really BIG CREDITS for knowledge transfer go to Cristophe Mermoud and Lukas Tönne.
A Ton (the greatest measurement unit in the blender universe) of thanks for them and You all !!

So the group statistics nodes for float and vector attributes on the point, edge, face and corner domains with the new search can be found in the link below:

group_attribute_statistics_FV.zip (655.4 KB)
(Added some examples/tests back to file)

Still hoping it is useful for someone until we may have have a build-in node for that. And let me know if you found some more bugs in the setups or have any suggestions for improvement.

13 Likes

GREAT! Thank you!


That was what I was hoping for since a long time!

1 Like

here it seems to be buggy… from resolution 77 on the normalisation doesn’t work correctly. 78+79 work, 80 again doesn’t and the higher the more go


wrong…

2 Likes

Thanks for testing!
Can confirm the issue … will have a detailed look later

1 Like

That was an error caused by low float precision when comparing values in the old search method…but luckily now we have a new one.

Updated the file in the first post.

2 Likes

fantastic, thank you. Seems to work fine now.

1 Like

There is another update, which includes support for point-clouds and curves. And a second Node handling vector attributes.

Updated the file in the first post again.

2 Likes

Found and fixed a bug for the vector node on the facecorner domain. Due to a missing checkbox, max was outputting min values in that special case.

4 Likes

This is cool ! I wanted that for so long !
Thanks a lot for looking into this, I don’t have something to test it right now but I’ll keep that engraved in my head until then !

1 Like

Found another Bug that i introduced while having stripped the permuted index from the group. Did that to reduce the complexity of it. And because no good use case came to my mind (only for sorting, where i would use the builtin Topo Group Sort node only. Which still gives you the permuted index). So the following output should not exists it was only forgotten to be removed. And it was internally not connected at all:
Attribute_Stat_Group_fix_permuted

During that move I accidently plugged the permuted index in the other indicies Field (“indicies min”). Which should just hold the same index for each group element pointing to the point with the minimum (for that group).

That output is meant to be used to get the the group minimas by index. See how selecting by index is done below:

Sorry, again if that issue caused some trouble. Updated The file in the first post with the fix. And added some examples back to the file.

3 Likes

Hello, first of all thank you so much for this!
I have run into issue with dense geometry, for example surface like this with 4 levels of subdivision and above, (5 on the pic) it’s skipping points created by the subdivision. After applying subd it is the same.
“Mean” is perfect, this issue is with “Min” and “Max”.
I guess it is related to the issue of low float precision when comparing mentioned earlier, so I guess it is still somehow there? Downloaded your file few days ago.
Thanks again

2 Likes

BTW it gets better somewhat if I increase mesh line point count to 3 in the “MO_Topo Group Sort” (with performance hit), but if I go above that its not getting better, while performance keeps suffering more.

Hmm…have been running into something similar around two weeks ago, when i was trying to build nearly the same thing to what @higgsas successfully found a more elegant version, while i was still searching for the bug in my setup.

When i was cranking up the density, it broke my mesh structure. Hunted it down to the Group Attribute Statistic Node.

That was also what came first to my mind. But i am not sure.
And if so, there is unfortunately not much i could do about it, because the comparison now takes place inside the code of geometry nodes itself. As the sort takes place in the C++ code of this Node:
edges_of_vertex

Sorry to say, but my attempts to simplify the problem failed, because in all my tries to do so everything functioned as expected.

3 Likes

That is strange, because how the sort buffer construct (should) work, i would not expect that changing the point count makes a difference at all.

1 Like

I’ve been trying to use the new Repeat Zone to make a more performant version of the Group Statistics Node with only partial success in that it only works for specific use-cases where I know the IDs I want to compare ahead of time and it requires a Geometry for the stats to be attached to…

Have you had a look at the Repeat Zone? Maybe there is something there you can use?

1 Like

By recreating a sorting algorithm inside geometry nodes ? (Which i would not expect to be faster than the c++ sorting algorithm of the node)
Or by optimization of another specific part of the node network? (Which i think is not really worth the work because most of the time is spend in the sorting part)

The only thing i could see at the moment that the loop helps for here is to clean up the nodegroup chain in the geometric median calculation.

1 Like

Sorry, I may have been unclear… Here is what I’m working on (I made some progress since my last post):
Grouped Attribute Statistics.blend (105.2 KB)

Works like your node-group (but only for Points/Vector for now…)


…But uses Repeat Zone to leverage the native Attribute Statistics Node at its heart:

Hope that makes more sense.

3 Likes

Wow yeah, great approach that could work.

1 Like

Next step would be to make 9 copies of that node-group and set to every domain for float and vector and then group those and have a mess of switching logic. But I’m done for today :sweat:

1 Like

Haha…that reminds me of something.

1 Like