How does rotation work at sop/dop level

   1263   1   1
User Avatar
Member
3 posts
Joined: April 2019
Offline
Hello !
There is something I don't understand, when I use the transform sop to rotate a packed geometry, where the pivot location is stored ? I tried to modify the intrisict attribute ‘pivot’ but it just moved my packed objet (I have no idea why) and the rotation pivot still the same when I use the transform sop…
Is there an attribute hidden somewhere that I didn't see ?

I know the transform sop has a pivot translate option but it's not permanent I'm looking for a way to declare a pivot point so every time I will use a transform sop or a pop spin dop (which doesn't have that pivot translate option) it will rotate around that point.

Also what is the instrisic attribute ‘pivot’ is used for ??

Thanks in advance for your answer
User Avatar
Member
406 posts
Joined: April 2017
Offline
The `pivot` primitive intrinsic defines the pivot point for each packed primitive… the Transform SOP doesn't consider packed primitive pivots when transforming things. The Transform SOP operates on everything as a whole, and it has no memory of adjustments to pivots you might have made upstream from within the Transform SOP.

You could maybe skirt around this by temporarily transforming all of your objects into the “pivot space” you're looking for (position P at the origin relative to the pivot point you actually want), then applying the transformation you actually want, then inverting that first transform by reference copying the first Transform SOP, enabling “Invert Transformation”, then applying it after you're done with your transformations with your new pivot.

As far as things like the POP Spin DOP, because those transformations happen locally to the packed primitives (unlike the Transform SOP's global transformation), you could adjust the pivots without moving the geometry, but it'll take a little work. To adjust the pivot point of packed primitives without moving the objects, there's a few steps you have to take:

  • Set the `pivot` primitive intrinsic to the new value
  • Compute the difference between this pivot and the original (as a vector)
  • Transform this difference into the packed primitive's local space by rotating the resulting difference vector deltaP by the packed primitive's `transform` intrinsic… you could do this by first extracting the `transform` intrinsic and then converting it to a quaternion, then rotating the vector by the quaternion like so:

    vector deltaPivot = new_pivot - old_pivot;
    matrix3 m = primintrinsic(0, "transform", @ptnum);
    vector4 orient = quaternion(m);
    deltaPivot = qrotate(orient, deltaPivot);
    

  • Compute the local scale of the packed primitive, since the pivot doesn't account for any scaling… you could do this via `cracktransform()`
  • Multiply deltaPivot by the scale vector, and add this result to @P.

    It's all a bit of a mouthful!
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
  • Quick Links