Skip to content

Instantly share code, notes, and snippets.

@jamesrobinsonvfx
Last active August 20, 2021 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesrobinsonvfx/25d18103a64cfc7873111ac3ea8fe799 to your computer and use it in GitHub Desktop.
Save jamesrobinsonvfx/25d18103a64cfc7873111ac3ea8fe799 to your computer and use it in GitHub Desktop.
Convert RBDs (Fetch Packed Geometry from DOP network style) to instancepoints. Pretty sure this is lifted from one of Henry Foster (Toadstorm)'s odforce/sidefx forum replies.
// Get packed xform and pivot
matrix xform = getpackedtransform(0, i@ptnum);
vector pivot = primintrinsic(0, "pivot", i@ptnum);
// Orient for instancing
p@orient = quaternion(matrix3(xform));
// Crack pscale
vector scale = cracktransform(0, 0, 2, 0, xform);
f@pscale = avg(scale);
// Offset P by pivot difference
vector new_pivot = {0, 0, 0};
vector offset = new_pivot - pivot;
v@P = offset * xform;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment