How can I extract the minimum and maximum values out of any node? Here I want to evaluate the maximum and minimum values measured by the 'distance node' and experiment further.
I have to manually go to geometry spreadsheet and find out the minimum and maximum values. Is there a more efficient way to do it?
Out of my head: If you promote an attribute (e.g. from points to primitive) you can specify how the values are merged (min, max and others). Of course, without deleting the former attribute.
Thanks. How do I work with that inside a VOP network? I need those values for doing fit range while specifying min and max. I end up doing manually by sorting the values from highest to lowest in the geo spreadsheet.
Also, if I am working with only points, without promoting the attribute to primitive, the attribute promote throws up an error because of source and target geometry being identical.
Before your VOP you'll need two attribute promote SOPs to get detail attributes for the minimum and maximum of the attribute. Then in your VOP you reference those detail attributes with a get attribute VOP.
pixelninja Before your VOP you'll need two attribute promote SOPs to get detail attributes for the minimum and maximum of the attribute. Then in your VOP you reference those detail attributes with a get attribute VOP.
Thanks! This is a very useful method. As I am only working with points, I first promoted the attribute to detail, then promoted back to point.
However, instead of giving out value with a single number (which is my requirement), it is giving the same value multiple times, (as it is promoting the value on all the points).
I think that's what causing issue here. Based on the minimum and maximum distances, I want to move the points in Y direction. What to do now?
Mohanpugaz I think that is not straight forward inside of vops.
Two ideas i have.
1. you may use vex snippet to iterate through all points and find maximum value. (You could also use for loop in vops)
2. You may store that value to a list/array, sort the array and get the last or first index.
Example here. You will Need to alter it to use inside vops.
int npts = @numpt; float test_values[]; for (int i = 0; i < npts; i++) { append(test_values, point(0, "test", i)); }
sort(test_values);
float max_value = test_values[-1];
I am not good at VEX. I don't understand this code except for the first line in which you created an integer attribute named 'npts' which is equal to the number of points.
You have "delete original" checked on your attribute promotes so they are deleting your dist attribute. Look at the parameters in the screenshot I sent and you'll see that is unchecked.
There's also no need to promote back to points. The purpose of a detail attribute is to have a uniform attribute value accessible by the whole geometry.
You promote your attributes to detail as shown in my previous post then read them into VOPs with get attribute nodes.
When you're reading attributes into VOPs you use a Bind VOP for reading attributes from the current geometry type (points in your case) and a Get Attribute VOP for reading attributes from other types (vertex, prim or detail in this case).