How to return the highest value in a point attribute?

   24630   10   1
User Avatar
Member
29 posts
Joined: 5月 2011
Offline
Guys,
Is there any expression to find the highest value in an attribute for the group of points in a geometry similar to point average expression function which returns the average of an attribute across all points in a geometry. I want to return the highest value of a pointattribute which is working among the points in a geometry. Is there a way to do this?

Regards,
nittin
User Avatar
Member
8833 posts
Joined: 7月 2007
Offline
you can use AttributePromote SOP to promote maximum of point attribute to detail attribute, then access it with detail() expression
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
29 posts
Joined: 5月 2011
Offline
Hi tamte,
Even i was thinking of the same idea, but i thought position of a point attirbute alway exsists and can never be promoted using attribute promote node. only custom attributes can be promoted, where it will start exisisting as a detail atrribute from the next node. But postion of point in space is not something like that. But if what u are saying is possible what should i keyin the channel of “ORIGINAL NAME” in the attribute promote node. I want to promote P attribute of points using the maximum option method in promote attribute node. But i dont know wat should i keyin the channel of 'ORIGINAL NAME" for p. If i am typing in P it is showing all sorts of error and the promotion is not happening. Can u help me with the syntax to be used there.

Regards,
nittin
User Avatar
Member
8833 posts
Joined: 7月 2007
Offline
here are a few methods you can use

Attachments:
pzmax.hip (47.9 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
29 posts
Joined: 5月 2011
Offline
Hi tamte,
Thank you so much for the options. I guess the method2 suggested by you in the attachment suits my context well. Thanks a lot

Regards,
nittin
User Avatar
Member
86 posts
Joined: 8月 2010
Offline
tamte
you can use AttributePromote SOP to promote maximum of point attribute to detail attribute, then access it with detail() expression
omg thanks,needed this
the xon can
User Avatar
Member
12 posts
Joined: 2月 2018
Offline
How do you do that but overtime tho?
Let's consider a pop sim with points being generated and dying over the course of the sim.
I want to record what was the highest point count over the course of the whole sim.
If I promote to max, it's going to evaluate every frame.

I tried recording with a solver but I can't find a clever way to do it yet.
If anyone has any ideas?
User Avatar
Member
8833 posts
Joined: 7月 2007
Offline
Thomas_FX
Let's consider a pop sim with points being generated and dying over the course of the sim.
I want to record what was the highest point count over the course of the whole sim.
since you are already in POPs, you can just keep max point count in the detail attrib using Geometry Wrangle and just increase it if its exceeded
int point_count = npoints(0);
i@max_point_count = max(i@max_point_count, point_count);
Edited by tamte - 2021年3月31日 23:35:29

Attachments:
ts_pop_max_points.hip (401.1 KB)
ts_pop_max_points.gif (340.6 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
12 posts
Joined: 2月 2018
Offline
Ok well I didn't expect the answer to be that simple considering how long I tried stuff with solvers and all ahah.
Thank you tamte, will definitelly put that to good use!
User Avatar
Member
12 posts
Joined: 2月 2018
Offline
Hey guys I'm back at it with a similar matter:

This time, I'm looking for an all-in-VEX version to determine a max value of a float overtime.
Last time it turned out that I was using a popsim and there was an already build-in attribute that I didn't know about, but for this specific case I don't have any build-in attribs.

Maybe I'm doing it wrong but the use for that would be pretty generic, however I mostly use that when I wanna determine the distance between 2 points, the highest one and lowest one over the course of the whole frame range.

The reason why I'd like to do that is to fit() this distance later on, and I'd like the range of the fit() to be procedurally updated.

EDIT: The way I currently do it with a solver writing down the point at every frame with the attribute, so I timeshift to $FEND after and promote the max and min attribute, but doing that is really not light just to output a max attribute value over time, I'm sure there is a better way to do it.
Edited by Thomas_FX - 2021年4月30日 13:02:26
User Avatar
Member
8833 posts
Joined: 7月 2007
Offline
Well, you have to consider all time values which you can't just with the wrangle on any specific frame unless that frame geo already contains all frame values represented as array or points for example


So you need something that will allow you to step through all frames or gather all frame values for further processing, some of your options are:
- sim (solver sop or in general any dopnet) and lookup last frame
- trail sop, freeze last frame and then attrib promote
- geometry chop and chop processing
- for each with timeshift inside
Edited by tamte - 2021年4月30日 22:38:49
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links