Jump to content

Recommended Posts

After packing geometry, if I use this VEX snippet to edit the pivots I get predictable results:

vector pivotOffset = chv("manual_pivot_offset");
vector pivotCentroid = primintrinsic(0, "pivot", @ptnum);
vector newPivot = pivotCentroid + pivotOffset;

setprimintrinsic(0, "pivot", @ptnum, newPivot);
@P += pivotOffset;

If I check "transform using point orientations" in the copy to points SOP and pack the copied geometry, the pivot will move according to the custom offset, but the object moves in a different direction.

How can I solve this?

Share this post


Link to post
Share on other sites

When changing the packed pivot, the packed transform is applied after applying the pivot translate. Here's an example to make it more clear: So let's say you have a sphere, which you parent to a locator. Translating the sphere corresponds to us changing the position of our geo that get's packed(Us changing the pivot is the inverse of this, which is what Houdini does under the hood when changing the pivot prim intrinsic). When you rotate the locator, the whole thing get's rotated. This means that if we translate the sphere, the rotation is still applied from the center of our locator. So if we were to unparent the sphere after rotating the locator in order to still keep the original transform we have to transform our sphere geometry to our locator space. In case of the packed prims this is done via pivotOffset * getpackedtransform(0,@ptnum);

vector @P;

vector pivotOffset = chv("manual_pivot_offset");
vector pivotCentroid = primintrinsic(0, "pivot", @ptnum);
vector newPivot = pivotCentroid + pivotOffset;
setprimintrinsic(0, "pivot", @ptnum, newPivot);

@P = pivotOffset * getpackedtransform(0,@ptnum);

I hope that kind of makes sense? Maybe I'm also completely wrong :D (The reason nothing happens when "transform using point orientations" is off is that the locator transform is "zero"/an identity matrix).

Edited by LucaScheller

Share this post


Link to post
Share on other sites
4 hours ago, LucaScheller said:

When changing the packed pivot, the packed transform is applied after applying the pivot translate. Here's an example to make it more clear: So let's say you have a sphere, which you parent to a locator. Translating the sphere corresponds to us changing the position of our geo that get's packed(Us changing the pivot is the inverse of this, which is what Houdini does under the hood when changing the pivot prim intrinsic). When you rotate the locator, the whole thing get's rotated. This means that if we translate the sphere, the rotation is still applied from the center of our locator. So if we were to unparent the sphere after rotating the locator in order to still keep the original transform we have to transform our sphere geometry to our locator space. In case of the packed prims this is done via pivotOffset * getpackedtransform(0,@ptnum);


vector @P;

vector pivotOffset = chv("manual_pivot_offset");
vector pivotCentroid = primintrinsic(0, "pivot", @ptnum);
vector newPivot = pivotCentroid + pivotOffset;
setprimintrinsic(0, "pivot", @ptnum, newPivot);

@P = pivotOffset * getpackedtransform(0,@ptnum);

I hope that kind of makes sense? Maybe I'm also completely wrong :D (The reason nothing happens when "transform using point orientations" is off is that the locator transform is "zero"/an identity matrix).

I understood the first part of the explanation, but the example you presented left me scratching my head.
I'm still walking on baby steps on all of this matrix transformation stuff, so I'm at fault here!

Thanks alot,
Diogo

EDIT: There are still small translations after changing the pivot, so it is still not solved :(

Edited by diogomgf

Share this post


Link to post
Share on other sites

Take a look inside MOPs Pivot, if you can download MOPs where you are. There's a bunch of VEX in there that shows how to modify pivots in a number of ways without affecting the visible appearance of the packed primitives. Pivot adjustments are affected by scale and orientation, so there's some tricky bits in there that are easy to miss...

  • Like 3

Share this post


Link to post
Share on other sites
On 27/09/2019 at 6:27 PM, toadstorm said:

Take a look inside MOPs Pivot, if you can download MOPs where you are. There's a bunch of VEX in there that shows how to modify pivots in a number of ways without affecting the visible appearance of the packed primitives. Pivot adjustments are affected by scale and orientation, so there's some tricky bits in there that are easy to miss...

Thanks, will have a look into it!

Share this post


Link to post
Share on other sites

@toadstorm I tried copying the pivot wrangle, and it works just fine.
I'll be dissecting it to see what I can learn :D

Cheers,
Diogo

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×