How to access alembic prim transforms in SOP

   1646   3   3
User Avatar
Member
2 posts
Joined: Nov. 2017
Offline
I have an alembic with many prims that need their position/ rotation animated at the SOP level. The original model has correctly oriented axis for all of its pieces and I know the alembic SOP sees this because the axis are all correct when "create primitives for" is set to "transform nodes only". Where I'm struggling with is actually accessing that data in a useful way to transform individual prims that have been split out downstream. Ideally I would think there would be a expression I could use in a Transform SOPs pivot transform PX PY PZ PRX PRY PRZ to get the transform of a object in the alembic using its path attribute.

Using just the spike as an example, there are many other hidden pieces that this needs to be applied to as well.





Axis in C4D is correct
Edited by marcuskulik - June 20, 2023 18:26:46

Attachments:
Screenshot 2023-06-16 143253.png (137.1 KB)
Screenshot 2023-06-16 143636.png (1.2 MB)
Screenshot 2023-06-16 143637.png (134.3 KB)

User Avatar
Member
447 posts
Joined: April 2018
Offline
See if this works for you:



vector pivot = normalize(primintrinsic(0, 'pivot', 0));
vector up = {0, 1, 0};

vector4 orient = dihedral(up, pivot);
v@pivot_rotations = degrees(quaterniontoeuler(orient, XFORM_XYZ));
User Avatar
Member
2 posts
Joined: Nov. 2017
Offline
Thanks eikonoklastes! It didn't work initially but I tweaked your wrangle and got it working properly!

Yours was giving me weird pivot rotations:

Swapping out quaterniontoeuler() with quaternion() seemed to fix it. I have no idea if this is "proper" but it gave the correct results. orientation and transformation matrices are still kinda a mystery to me.

Also added the @pivot_translate detail using P, which has the correct values but may not be the best attrib to use for that, do you know if the translation is stored in another intrinsic attrib?
vector pivot = normalize(primintrinsic(0, 'pivot', 0));
vector up = {0, 1, 0};

vector4 orient = dihedral(up, pivot);
v@pivot_rotations = degrees(quaternion(orient));
v@pivot_translate = point(0,"P",0);

quaterniontoeuler():


quaternion():
Edited by marcuskulik - June 20, 2023 18:26:32

Attachments:
Screenshot 2023-06-20 152429.png (71.4 KB)
Screenshot 2023-06-20 152453.png (71.4 KB)

User Avatar
Member
447 posts
Joined: April 2018
Offline
marcuskulik
Thanks eikonoklastes! It didn't work initially but I tweaked your wrangle and got it working properly!
Yours was giving me weird pivot rotations:
Try not normalizing the pivot, maybe that will sort it.

For the position, you can use the xyz values of the pivot itself. If you use P, it uses the centroid, which should be correct, but in case it's not, the pivot will sort it.
Edited by eikonoklastes - June 21, 2023 02:16:41
  • Quick Links