Adding custom point attributes to an array

   4918   6   2
User Avatar
Member
12 posts
Joined: May 2015
Offline
Hey Guys.
I've searching for a while can't can't quite find an answer that helps me out much, so here I am

I've created a custom point attribute called ‘exceedThreshold’ It's just a simple 1 or 0 on each point of my mesh. What I want to do is add each point's exceedThreshold value to an array so that I can check the array to see if any 1's exist (and then if they do it'll flip a switch and do other cool stuff). The closest I've gotten is (all in a VOP network) using a for loop to create an array and then a for each loop to check the array for any 1's. It halfed worked. What ended up happening was it created one array for each point, containing as many elements as there were points, and each element was just the same value as the exceedThreshold attribute was before the array was created.

For example, point 0 had an exceedThreshold value of zero, so the array for it was just 8 zeros.

I've also tried a few other things that failed miserably.

If anyone has any answers as to how I can get this done, or even just point me in the right direction, I would be very appreciative. Also I realize it might be a super simple solution that I've missed, but I'm at the end of an 11 hour day at uni so my mind is kinda fried. Thanks again to anyone who can help

P.S. I'm using Houdini15 if that is at all relevant.
User Avatar
Member
252 posts
Joined:
Offline
I'm not sure if this would help as I'm fairly new to VEX.

In the attached file, I used a couple of Wrangle nodes to:
  1. create the exceedThreshold point attribute.
  2. create a array from those as a Detail attribute (although I don't know how to process the array using expressions..)
  3. create a “switch” attribute to control the input of a Switch SOP.

    * The scene has an animated box which will select and group points.
    * The grouped points will have an exceedThreshold value of 1.

Attachments:
exceedThreshold.hipnc (125.4 KB)

User Avatar
Member
12 posts
Joined: May 2015
Offline
Thanks so much for that jlim, it was a massive help. I modified the project slightly to get the effect I was after, and it worked perfectly I'll attach it below.

Attachments:
exceedthreshold_Modified.hipnc (115.7 KB)

User Avatar
Member
252 posts
Joined:
Offline
Glad I was able to help
User Avatar
Member
8555 posts
Joined: July 2007
Offline
to avoid tedious array business you can just use Attribute Promote to get maximum of your point attrib as a single detail attribute value and then switch your color based on that

Attachments:
exceedthreshold_attrpromote.hipnc (102.3 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
12 posts
Joined: May 2015
Offline
Thanks tamte. It certainly looks a lot simpler. Just to clarify that i understand whats going on, the Attribute Promote Node is taking only the maximum exceed threshold value of all the points on a given frame, and then basically applying that to the object as whole instead of each point?
User Avatar
Member
8555 posts
Joined: July 2007
Offline
yes, in this case it basically promotes attribute from points to detail
which means that it applies the chosen operation to attribute values of all the points, in this case it picks maximum value from all (but you can as well do minimum, average, sum, …)

if you would promote from points to primitives with max
then you would get primitive attribute where each primitive would store maximum value of given attribute among just points of that primitive

etc.
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links