2
$\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$
    – Chris
    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$
    – Gorgious
    Jun 29, 2021 at 7:11
  • $\begingroup$ @Chris: yes that's right. $\endgroup$
    – d401tq
    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$
    – d401tq
    Jul 1, 2021 at 3:15
  • $\begingroup$ feel free to upvote this rightclickselect request : blender.community/c/rightclickselect/wKvz/?sorting=hot $\endgroup$ Aug 6, 2022 at 21:04

1 Answer 1

2
$\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$
    – d401tq
    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$ Aug 6, 2022 at 21:46

You must log in to answer this question.

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