3
$\begingroup$

Is there a way to find the minimum and maximum values of a particular geometry node attribute?

As an example, let's say I have a bunch of points which have had a number of manipulations performed on them, which have some randomness included. I would then like to modify the 'z' position of these points according to their distance from the origin, 'd'. In particular, I would like to apply the following maths:

z = a*((d - d_min)/(d_max - d_min))^2

where 'a' is some input value, 'd' is the distance from the origin, which I can easily calculate, and 'd_min' and 'd_max' are the minimum and maximum values of 'd', respectively, which I don't know how to obtain.

It seems like this really should be easy to do - I can look through the spreadsheet at all the values of 'd' after all...

$\endgroup$
5
  • $\begingroup$ so you mean e.g. like the maximum z-position of ALL points? $\endgroup$ Commented Jun 29, 2021 at 5:36
  • 3
    $\begingroup$ I think it's not that straightforward to get these values, like in the shader editor each individual geometry piece isn't really aware of its surroundings, apart from vertices and edges which belong the same face. There is a Bounding Box node that should cover the min and max enveloppe points of the mesh $\endgroup$ Commented Jun 29, 2021 at 7:11
  • $\begingroup$ @Chris: yes that's right. $\endgroup$ Commented Jul 1, 2021 at 3:14
  • $\begingroup$ @Gorgious: I agree a similar problem exists in the shader editor, but there seems to be a relevant difference in that you often need to render in order to get the properties you care about, but you often want them before you render. Here though, the geometry is generated before render item. In my specific example I was thinking of point instances, but I think it's equally valid to think of mesh vertices. Either way, all the info is available to Blender since one can simply read it in the spreadsheet editor - it would just require Blender to read those values and find the min/max. $\endgroup$ Commented Jul 1, 2021 at 3:15
  • $\begingroup$ feel free to upvote this rightclickselect request : blender.community/c/rightclickselect/wKvz/?sorting=hot $\endgroup$ Commented Aug 6, 2022 at 21:04

2 Answers 2

4
$\begingroup$

I would hope a better way is introduced latter, but for now:

  1. Assign the attribute to the position x value
  2. Get the bounding box
  3. Seperate out the x max/min
  4. Merge the value back into the original geometry

Getting the maximum of a random value

Spreadsheet of results

$\endgroup$
2
  • $\begingroup$ Perfect, thank you. Agree: a more elegant solution from the devs would be great! $\endgroup$ Commented Jul 31, 2021 at 18:11
  • $\begingroup$ The main limitation of this method is that you can't return outputs for grouped IDs like you can with the Accumulate Field node. This proposal I made could address that if implemented : blender.community/c/rightclickselect/wKvz $\endgroup$ Commented Aug 6, 2022 at 21:46
0
$\begingroup$

The Attribute Statistic Node can easily do this, along with other useful metrics. It's in 4.0+, but I think it was introduced sometime in 2023.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.