Filtering Copy node by expression, am I doing it right?

   2891   8   2
User Avatar
Member
517 posts
Joined: Dec. 2013
Offline
Hi there,

I am filtering the copy node to only copy to points with an attribute above a certain value and it seems to be working but I feel there's probably a better way, could someone have a look at this and see what you think?
I just have a feeling I am over complicating it.








Here's the scene -
http://www.peterleary.com/ForumFiles/FilterByAttribute-kwRgeT1VLf.hiplc [peterleary.com]

Thanks,
Pete
User Avatar
Member
2537 posts
Joined: June 2008
Offline
What you have does work, but you could reduce all those nodes down to a single wrangle.

vector freq = {1,1,1};
vector offset = {0,0,0};
float amp = 1;
int turb = 5;
float rough = 0.5;
float atten = 1;
float NoiseSelect = fit11(onoise(@P*freq - offset, turb, rough, atten) * amp,0,1);
if (NoiseSelect > 0.5) {
setpointgroup(0, “CopyFilter”, @ptnum, 1);
}

Attachments:
ap_FilterByAttribute-kwRgeT1VLf.hiplc.hipnc (104.6 KB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
8568 posts
Joined: July 2007
Offline
no group necessary, just keep your VOP that creates the attribute
then in Copy SOP's Template Group write
@NoiseSelect>0.5

Attachments:
FilterByAttribute-fix.hiplc (79.7 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Thanks for posting the question, its threads like this that really help in moving over to vex

Rob
Gone fishing
User Avatar
Member
517 posts
Joined: Dec. 2013
Offline
That's great, I had no idea you could get that all in a Attribute Wrangle node!?

I think I'll stick with the Point Vop and the template set to @NoiseSelect>0.5.
Since I'm really new to Houdini, the Point Vop interface is a little easier for me (and it reminds me a little of softimage ICE).
Also if it runs a little slower that's okay since I'm FBX-ing all of my work out for unity.

Thanks guys!
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
VOPs and wranglers generate the same VEX code so no worries about performance.

Both will run at the same speed if they generate the same code at the end.

Use VOPs to learn and get going and to build proper first class assets for further re-use later on.

Wranglers are just a convenience for TD's who just want to “wrangle” some attributes quickly without diving in to VOPs to construct a network.


Many times wrangle code gets out of hand where VOPs makes more sense for portability and learnability imho.
There's at least one school like the old school!
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
So Jeff , basically the rule of thumb is if you can create your data in vex wrangles or attribute vops , you should. ie

if (@Cd.r >= 0.5) {
setpointgroup(0,“grp_isred”, @ptnum, 1);
}


Is going to be faster than actually creating the above in the group SOP .

Rob
Gone fishing
User Avatar
Member
8568 posts
Joined: July 2007
Offline
there is no guarantee that VEX will be faster than native operators, you better test it for every case (in case of Group SOP by expression, VEX seems to be faster though)

on the other hand setpointgroup() will probably be slower than i@group_ at least for heavy geometry since it's not multithreaded
so if you want to create group from attribute in VEX instead of using ad-hoc groups, you rather use:
i@group_grp_isred = @Cd.r > 0.5;
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Agree with Tamte.

Test every case with the Performance Monitor when fine tuning performance of critical networks. All TD's should be well versed in the use of the Performance Monitor as an important debug tool.

Clarification on wranglers. Most wranglers are placed directly on top of a VEX node so in most cases, my statement should be a good guide to use VOPs and wranglers.

In some HDA assets that have wranglers at the top level, there may be other non-VEX based SOP types inside the HDA asset that will break my general comment above.

Again always test when performance is critical.
There's at least one school like the old school!
  • Quick Links