Whats the best way to randomly delete X numbers of pieces?

   7280   2   0
User Avatar
Member
25 posts
Joined: Nov. 2019
Offline
I have shattered an object, so i have the pieces names to work with, but i cant seem to get a fully functioning random deletion node network working. I've tried it with a by-connection for loop that would randomly delete a piece per cycle based on a threshold, but that only ever deleted all or none of the pieces.

I'm still very new with Houdini, so i'm probably missing something simple… but i'm sure there's a better way, as well. A short VEX snippet in an attribute wrangle maybe? Just need something to randomly delete pieces of geometry by name/piece number.
User Avatar
Member
5109 posts
Joined: Feb. 2012
Offline
You can use something like this in a primwrangle:

if (rand(random_shash(@name), ch("seed") * 3.734645) < ch("threshold"))
    removeprim(0, @primnum, 1);
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
25 posts
Joined: Nov. 2019
Offline
ohh nice! i hadnt seen that random_shash before, that should do it, thanks much!
  • Quick Links