How can I implement the PointDeform feature in VEX

   685   12   1
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
How can I implement the PointDeform feature in VEX? I want to bind the rotation and translation of one object to another. I haven't found any answers on the forum! This feature is very important, like a parent-child relationship.
User Avatar
Member
8822 posts
Joined: July 2007
Offline
you need to be more specific
Point Deform is already implemented in VEX, just look inside

however, what you are describing is more like parent constraint, you can use plenty of different approaches for that
- Transform Pieces SOP
- directly building your hierarchy in KineFX, which automatically updates children transforms
- Parent Constraint VOP
- something like:
4@child_world_xform = 4@child_local_xform * 4@parent_world_xform;
- or:
4@child_world_xform = 4@child_world_rest_xform * invert( 4@parent_world_rest_xform ) * 4@parent_world_xform;
- ...
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
4726 posts
Joined: Feb. 2012
Offline
Hi,

If you mean something like following the same transformation, you can use the Extract Transform SOP.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
tamte
you need to be more specific
Point Deform is already implemented in VEX, just look inside

however, what you are describing is more like parent constraint, you can use plenty of different approaches for that
- Transform Pieces SOP
- directly building your hierarchy in KineFX, which automatically updates children transforms
- Parent Constraint VOP
- something like:
4@child_world_xform = 4@child_local_xform * 4@parent_world_xform;
- or:
4@child_world_xform = 4@child_world_rest_xform * invert( 4@parent_world_rest_xform ) * 4@parent_world_xform;
- ...
For example, an object has rotation, and I need to calculate its rotation information and apply it to my model. I also need to convert this information into xyz angles and assign the values to the rot attribute of the Transform node.
Edited by 444366454 - Dec. 10, 2024 19:44:33
User Avatar
Member
8822 posts
Joined: July 2007
Offline
You better post a simple example file, otherwise I'd just repeat my post with all possible options you can use

Also you most likely don't need to use Transform SOP and fill in euler values unless for some reason that's the goal, otherwise you can use Transform By Attribute or as mentioned nodes that implement it internally like Transform Pieces, but if you post a hip file with your case you will likely get a working file back without ambiguity of trying to describe it in words
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
animatrix_
Hi,

If you mean something like following the same transformation, you can use the Extract Transform SOP.
However, if it is a model of ABC, it cannot extract its angle.
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
tamte
You better post a simple example file, otherwise I'd just repeat my post with all possible options you can use

Also you most likely don't need to use Transform SOP and fill in euler values unless for some reason that's the goal, otherwise you can use Transform By Attribute or as mentioned nodes that implement it internally like Transform Pieces, but if you post a hip file with your case you will likely get a working file back without ambiguity of trying to describe it in words
Image Not Found

Attachments:
Test.hip (373.2 KB)

User Avatar
Member
8822 posts
Joined: July 2007
Offline
here is a modified file with
- Transform pieces method
and
- if interested, custom VEX method to compute the transform matrix, but still using Transform By Attribute afterwards as that takes care of all cases of transformable geo and attributes, similar to Transform Pieces

since your objects are transforming after being packed and I assume your alembics contain transforming object this method should work
If however you had just deforming geo only then you would need Extract Transform on unpacked geo before connecting to transform pieces
Edited by tamte - Dec. 13, 2024 09:00:16

Attachments:
Test_mod.hipnc (364.1 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
tamte
here is a modified file with
- Transform pieces method
and
- if interested, custom VEX method to compute the transform matrix, but still using Transform By Attribute afterwards as that takes care of all cases of transformable geo and attributes, similar to Transform Pieces

since your objects are transforming after being packed and I assume your alembics contain transforming object this method should work
If however you had just deforming geo only then you would need Extract Transform on unpacked geo before connecting to transform pieces


Hi tamte.What I mean is that the imported model is an Alembic model with animations. There is no packedfulltransform for the ABC model. And I need to figure out the Angle of his rotation,
User Avatar
Member
8822 posts
Joined: July 2007
Offline
444366454
Hi tamte.What I mean is that the imported model is an Alembic model with animations. There is no packedfulltransform for the ABC model. And I need to figure out the Angle of his rotation,
in that case you probably have deforming geo in your alembic and not transforming objects as they would still have "packedfulltransform" since Alembic can hold either

so as mentioned use Extract Transform before Transform Pieces to compute the actual transform difference between rest and current frame geo

Attachments:
Test_mod2.hipnc (375.4 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
tamte
444366454
Hi tamte.What I mean is that the imported model is an Alembic model with animations. There is no packedfulltransform for the ABC model. And I need to figure out the Angle of his rotation,
in that case you probably have deforming geo in your alembic and not transforming objects as they would still have "packedfulltransform" since Alembic can hold either

so as mentioned use Extract Transform before Transform Pieces to compute the actual transform difference between rest and current frame geo
Image Not Found




I added a comment. It'll make you understand me better

Attachments:
Test.hip (467.1 KB)

User Avatar
Member
8822 posts
Joined: July 2007
Offline
your issues are stemming from the fact that the alembic interpolates deforming geometry linearly inbetween frames
so rotated geometry will distort a bit in-between frames, which in turn will result in slightly different best fit rigid transform than if the geo was not distorted
and since you are observing your timeline on fractional frames you see the issues like heartbeat scaling and misalignment (since you are comparing to transform that's using just rotation)

so if you don't want or can't export your alembic with transforming objects and have to use deforming geo, compute the Extract Transform only on integer frames and interpolate resulting transform after Extract Transform using TimeBlend SOP with Interpolate Rotation ... checked and maybe even Interpolation set to Cubic or Subdivision
(rather than keeping the linear Alembic interpolation of the geo before Extract Transform)
Edited by tamte - Dec. 13, 2024 20:54:38
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
18 posts
Joined: Jan. 2022
Offline
tamte
your issues are stemming from the fact that the alembic interpolates deforming geometry linearly inbetween frames
so rotated geometry will distort a bit in-between frames, which in turn will result in slightly different best fit rigid transform than if the geo was not distorted
and since you are observing your timeline on fractional frames you see the issues like heartbeat scaling and misalignment (since you are comparing to transform that's using just rotation)

so if you don't want or can't export your alembic with transforming objects and have to use deforming geo, compute the Extract Transform only on integer frames and interpolate resulting transform after Extract Transform using TimeBlend SOP with Interpolate Rotation ... checked and maybe even Interpolation set to Cubic or Subdivision
(rather than keeping the linear Alembic interpolation of the geo before Extract Transform)

tamte
Thank you very much!!
  • Quick Links