Jump to content

Custom pivot location on packed primitives

Recommended Posts

Hey all! I'm packing imported geometry into thousands of primitives using a connectivity attribute. What would be the best way to set custom pivot locations in the process, instead of the centroid or origin options? Something as simple as using the centroid for X and Z and 0 for Y., for example?

Share this post

Link to post
Share on other sites

Good question !

theoretically you can use in a (point context) wrangler :

setprimintrinsic(0, "pivot", @ptnum, set(6,6,6) );

But that will move your geometry and update your "packedfulltranform" attributes into the inverse of your new pivot offset.


>> If you import an alembic from Maya you get the same values on :

- Point Position

- intrinsic "packfulltransform"

- intrinsic "pivot"


>> If you export an alembic from houdini /out on which you animated objects nodes on the /obj level you get the same behaviour as the above, all attributes are updated in same manner.


>> But if you have 1000 objects inside an object node and you want to tweak and set correct "packedfulltransform" + "pivot" + having the correct translation on your points, you will find out that there is some secret magic that takes :

the "pivot" and tries to compensate on the point position and packedfulltransform matrix ? one to the other every time you change something . (and of course updating the packedfulltransform)


-- It would be great if someone could tell us, how intrinsics update exactly ?

-- Is there a way to set your own pivots that follow your pack object ?

-- The "centroid" option on the "pack" node looks like the correct thing (gives you an animated intrinsic:pivot ), is there a way that can be initialized with an offset ?

-- Using "origin" option on the pack node gives you 0 values on pivot, packedfulltransform and point P, but the object still moves in the viewport (voodoo?),  does that mean there are other attributes that are not exposed to the user ?


Thank you ,





  • Like 2

Share this post

Link to post
Share on other sites

Thanks Sokratis, yes I went through the same thought process, once the geometry is packed there's no way of changing point position without moving the packed geometry as well, since that would in fact change the geometry in relation to its "pivot", so it has to be done before it's packed. For now the workaround I found was to: 

- Pack the geometry with pivot at centroid

- Set @P to (0,0,0)

- Unpack

- Offset the geometry

- Repack it with its pivot at origin

- Set @P to initial position minus offset.


I'm thinking there must be a more efficient way to do this.

Share this post

Link to post
Share on other sites

This should work:

1) Write your custom pivot in an attribute before packing.

2) Pack with Pivot Location at Origin. Make sure you transfer your pivot attribute while packing.

3) In a point wrangle, copy the pivot values to the pivot intrinsic, also add to the point position.

Share this post

Link to post
Share on other sites

Just a quick update on this..2 years old entry! :)

As I had issues with this and found a way thought I'll share it, so basically after packing with Pivot set to "Centroid" add a wrangle

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

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

Just one another way :)

  • Like 2

Share this post

Link to post
Share on other sites

So far, in my experience that's doesn't help.

The way im doing is passing by the origin, not the centroid and be sure i center and align the bounding box of my geo before packing


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