why this will not work:
a scatter sop and a pointwrangle with:
if ( rand(@ptnum) > ch('threshold') ) {
removepoint(0,@ptnum);
}
Hm, still dont see points, neither with a low nor a high threshold value.
Random delete points by threshold
17146 7 0-
- Follyx
- Member
- 236 posts
- Joined: June 2006
- Offline
-
- djwarder
- Member
- 83 posts
- Joined: Nov. 2018
- Offline
Hey, just had a look at your wrangle node & got it to work! Added backticks to the ch() command and changed your ‘Export Parameters’ back to the default ‘*’ value.
Also, remember that rand() only produces floats in range of 0-1, so need a lower threshold. Let me know if that fixes it …
Dan
Also, remember that rand() only produces floats in range of 0-1, so need a lower threshold. Let me know if that fixes it …
Dan
Dan Warder
Senior FX TD - Framestore
Senior FX TD - Framestore
-
- jlait
- Staff
- 5710 posts
- Joined: July 2005
- Offline
I'd recommend not using `` on the ch() expression as that will generate a new VEX code snippet everytime the threshold changes. Which could get expensive for recompiling!
The reason the ch('threshold') does not work is because the Bindings::Evaluation Node Path was set to ../scatter1. This meant it tried to read the parameter ch(“../scatter1/threshold”). And the scatter sop doesn't have that parameter, so it is returning 0. This results in all the points being deleted.
Changing the Evaluation Node Path to the default “.” and making the threshold 0..1 should thus also fix this.
The reason the ch('threshold') does not work is because the Bindings::Evaluation Node Path was set to ../scatter1. This meant it tried to read the parameter ch(“../scatter1/threshold”). And the scatter sop doesn't have that parameter, so it is returning 0. This results in all the points being deleted.
Changing the Evaluation Node Path to the default “.” and making the threshold 0..1 should thus also fix this.
-
- Follyx
- Member
- 236 posts
- Joined: June 2006
- Offline
-
- MilanB
- Member
- 127 posts
- Joined: Nov. 2018
- Offline
-
- BabaJ
- Member
- 1904 posts
- Joined: Sept. 2015
- Offline
The rand function adds 0 or 1 to all the points? Why can't i see that in the spreadsheet so i can maybe know which points are being deletet?
Could you clarify your question?
Are you referring to the ops' hip file. Note that they are making use of the wrangles evaluation path. And as the hip stands(it's an old post and I just opened it as is)…they don't have a parameter of the name ‘threshold’. So the default value used in the expression is 0.
Since rand returns values between 0-1 all conditions of the if statement return true, so all points get deleted. (pointwrangle4 with display flag enabled).
Edited by BabaJ - Sept. 27, 2019 09:15:28
-
- paranoidx
- Member
- 19 posts
- Joined: Feb. 2018
- Offline
-
- animatrix_
- Member
- 3791 posts
- Joined: Feb. 2012
- Offline
ch will also work, I use it all the time but never chf personally:
https://www.sidefx.com/docs/houdini/vex/functions/chf.html [www.sidefx.com]
https://www.sidefx.com/docs/houdini/vex/functions/chf.html [www.sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

patreon.com/animatrix | vimeo.com/animatrix3d
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

patreon.com/animatrix | vimeo.com/animatrix3d
-
- Quick Links