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?

Link to comment
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 ,

Best!

 

 

 

  • Like 2
Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • 2 years later...

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 3
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...