Jump to content

object looping & transform extraction - faster than foreach


Recommended Posts

Is there a faster way of looping through individual objects (where "object" refers to a group of primitives) than using a foreach SOP - perhaps in VOPs/VEX?


The context is trying to extract transforms for a bunch of shattered pieces, given only the rest frame and current frame.  Currently, I'm using a foreach looping over a primitive Name attribute (not groups), to build a coordinate system for each piece, but with several thousand pieces, it's very slow.


I realize that there are various ways of skinning this (or any) specific cat in Houdini, and I know about the DOPImport Create Points option.  In this particular case, I'm taking the output from one DOP sim breaking it into two frame-dependent changing object streams, and injecting those into another DOP sim, rinse, repeat.  This quickly leads to a situation where the transforms coming out of the last DOPnet are relative to a very weird looking "creation" frame.  Hence, my desire to obtain "clean" transforms by just extracting them from the geo - which would also allow me to get transforms relative to an arbitrary rest position of my choosing.  A good tool for the general kit.


So that's one thing - solving this particular case.  But I feel like there's a broader question here related to Houdini's general philosophy of treating geo in bulk, rather than as individual objects in a hierarchy.  It feels like translating between blobs of polygons and objects with transforms would be a common enough operation that there'd be a fast built-in for it - in the same way that going in/out of a DOPnet or packed primitives requires such a transform.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...