[Geonodes]Perform an operation on Face Corners belonging to a Face (Solved more or less)

I need to read minimum and maximum of an attribute belonging to face corners inside a face. How do I do it per each face separately? Attribute Statistics will normally iterate through each face corner of a mesh

https://gyazo.com/e7fe4119017559eb35c0ce8835033f88 This setup SEEMS to work, can anyone confirm it is correct way? Especially plugging Index to both A and B of Compare

No, I think it doesnt work, the results are strange

If I am being confusing again, I’ll try to express the task in pseudo code

for face in mesh.faces:
____min = AttributeStatistics(face.faceCorners,referenceFloat,min)
____max = AttributeStatistics(face.faceCorners,referenceFloat,max)
____DoSomething(min, max)

The interpolate domain node should do the trick:


What version it is? Dont see it in 3.2

… oh its 3.3 Beta. Formerly it was called Field on Domain.

And before that you could have used capture attribute to interpolate the domain.

1 Like

Thank you; never could’ve guessed what it does from name. I’ll go look for version that has any of them

1 Like

The problem with @moshus’ method is that it only singles out a single face for Statistics… so not quite what you’ve asked for.

As I’ve mentioned before, Attribute Statistics is missing a “Group ID” input similar to Accumulate Field to allow for a field-output which would solve your issue. From my understanding, what you are looking for is not yet possible in GN.

Sorry for the bad news, good luck.


Yes, no matter what I do with this idea, the program seems to calculate minimum and maximum through the entire mesh. So until they indeed add group IDs, or tangent input which I tried to calculate

Yeah i lazily misread the question again.

And Absolutely agree that an group id field for statistic would be really nice. would make the problem very easy to solve.

But i do not agree that it is not possible in GN. But yeah it is very far away from being easy.

Very smart people already implemented group sorting algorithms. Erindale has one in his toolkit. And with the help of another group node from a guy called Christophe Mermoud, i was able to solve the problem for every arbitrary face of a mesh:

Unfortunately i do not know anymore where i got the file with the sort group from. Also could not found it again on the internet. And i am not sure if it is ok to give it away here.

1 Like


I’m guessing the sorting is a bunch of stacked switches? If you can guarantee that a face will have no more than 4 face-corners, then something like that should be doable.

Good work!

No it is much more smarter it works even for an arbitrary count of face-corners:

Also not sure anymore how the sorting algorithm is called. Something i never heard before. This is how the sort group looks like:

And i am quite sure that he is willing to share his group (otherwise i would not have been able to download it, except he made it public by mistake)…he has an account on blender development and subscribed for the task of creating an asset nodegroup bundle . Maybe someone else can re-find it on the internet or is able to ask him if it is ok.

1 Like

Building off of your example, here is a version which will pick the smallest of quads - it’s just a proof of concept.

smallest of 4.blend (95.0 KB)


Refined your version to support faces from tris to 6-gons. And could be stacked further…
smallest_from_tris_to_6_gons.blend (116.0 KB)

And probably it would be more elegant to move the nodes who compares the face corner indicies into the node group and iterate the index in the group by adding one and passing it to next group. So you just stack one group per next vert.

1 Like

ok had to much fun with stacking…
smallest_from tris_up_to_alot.blend (131.7 KB)

1 Like

I wish I could understand what is going on here…

1 Like

Yeah, that’s why Attribute Statistics needs a Group ID input. :fearful:

1 Like

I think I got something that should work in general:

Should be magnificently inefficient though:

The idea is to create an instance of a single quad per domain entity (in this case, face corners), offset it by the value we want to create our statistic on in z direction and by the group index in x direction, yielding something like this:

Now these are ordered in z-direction according to the value we want to sort.

The second step is to line up these quads along a spline: splines have an order we can later exploit (by selecting the endpoints for min and max values and the midpoint for the median).

We do this by creating an instance of a mesh line on every face and using raycast in z direction to place one of the ednpoints on the next quad:

Now we merge by distance and convert the mesh lines to splines.

Using transfer attribute by distance, we can now attach the values we want to sort to the spline control points.

As mentioned above, the kicker is that the min and max values will be at the spline end points, and those we can find easily. The mean value per spline is simply found by the attribute statistic node:

Finally, we collapse the curves into points on the x-axis and transfer the statistics back to, in our case, the face corners:

I added a a bit of randomness to the z-position of the quads to get a defined order (and catch all of the values). this may lead to problems.

idiotic_statistic_per_group.blend (128.2 KB)
As I said, a fairly stupid method.


Creative approach!

1 Like