Jump to content

Primitive intrinsic transform scale and translate


Mozzarino

Recommended Posts

After setting up the rotations for packed objects in point vops (after scattering), I just couldn't do the same for scaling and translating.
I want to find a solution for cases where the scattering has already been done (or there are many instances of the same object).

Can some one help me out?

Bellow is the hip file.

packed_objects_debug.hip

Edited by diogomgf
Link to comment
Share on other sites

Hi Diogo,

To apply scale/rotate/translate after instancing you have to first undo the transform(transform in this case is actually only the scale/rotation matrix). Then you can apply your custom transform(scale/rotation matrix) to the now identity matrix (You could actually use an identity matrix here instead of applying the inverse to the incoming matrix, it's just visually more easy to understand). After that you have to reapply/restore your original transform by multiplying your custom transform with the original transform. This should do for scale and rotation.

For translate you can do hacky pivot workarounds. I went a different direction and just pushed the P attribute along the different rotation axes.

I've made the changes to your file. Let me know if you have further questions. I can also recommend looking at the MOPs Toolset (https://www.motionoperators.com/)  to understand what's going on, as quite a few nodes manipulate packed transforms.

All the best,

Luca

Transform.jpg

packed_objects_debug.hip

Edited by LucaScheller
  • Like 1
Link to comment
Share on other sites

47 minutes ago, LucaScheller said:

Hi Diogo,

To apply scale/rotate/translate after instancing you have to first undo the transform(transform in this case is actually only the scale/rotation matrix). Then you can apply your custom transform(scale/rotation matrix) to the now identity matrix (You could actually use an identity matrix here instead of applying the inverse to the incoming matrix, it's just visually more easy to understand). After that you have to reapply/restore your original transform by multiplying your custom transform with the original transform. This should do for scale and rotation.

For translate you can do hacky pivot workarounds. I went a different direction and just pushed the P attribute along the different rotation axes.

I've made the changes to your file. Let me know if you have further questions. I can also recommend looking at the MOPs Toolset (https://www.motionoperators.com/)  to understand what's going on, as quite a few nodes manipulate packed transforms.

All the best,

Luca

Thanks alot, this solved it!

Cheers,
Diogo

Link to comment
Share on other sites

1 hour ago, LucaScheller said:

I would stick to manipulating the actual pivot beforehand (like you already had in your file), since changing the pivot in the makexform only manipulates the center of the makexform and not the actual packed pivot, which results in confusing results.

 

Ok, will do it that way then. Though when I change the pivot with this method I get changes in the position of the prims even without changing the @P attr.

Edited by diogomgf
Link to comment
Share on other sites

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...