Jump to content

Extracting Relative Transforms


Recommended Posts

Hey Houdniks!

I'm looking for a way to extract transforms from two objects to use in DOPs.

Basically:

I have object A, teapot sitting at the origin.

I have object B, an animated teapot flying around. This is brought in through a file sop i.e. baked.

Both objects have the exact same topology, point count.

How would you extract the transforms so that Object A is able to be transformed exactly into the motion path of object B?

Been trying out stuff in CHOPs but I can't really figure out a good way.

Thanks for any ideas!

Alvin

Link to comment
Share on other sites

Hey man!

Thanks! This is exactly what I'm using atm, but we will always need to adjust the static object to get it's first frame alignment properly. I want to avoid that in order to streamline things as well as get the exact accurate transforms.

Cheers!

Alvin

Link to comment
Share on other sites

An idea would be to pick three non-collinear points from the teapot and use that to form a frame of reference. Now for each frame, you create a rotation matrix out of the frame of references created from object A and object B. Now you explode this matrix and use its euler rotation angles for the transform. Then run it through a default Transform CHOP to ensure that there's no subframe flipping. For translations, use the delta from the origin of the frame of references. Hmm ... well, you might need to translate the origin point to 0,0,0 first.

Link to comment
Share on other sites

What you're talking about here is a very common tool at all the bigger houses... kind of a Rivet Object but in SOPs; and group-aware. It's such a common need that I'd think that there might be enough reason to consider asking that SESI should consider providing such an animal in the Houdini tool-set.

An idea would be to pick three non-collinear points from the teapot and use that to form a frame of reference. Now for each frame, you create a rotation matrix out of the frame of references created from object A and object B. Now you explode this matrix and use its euler rotation angles for the transform. Then run it through a default Transform CHOP to ensure that there's no subframe flipping. For translations, use the delta from the origin of the frame of references. Hmm ... well, you might need to translate the origin point to 0,0,0 first.
Link to comment
Share on other sites

What you're talking about here is a very common tool at all the bigger houses... kind of a Rivet Object but in SOPs; and group-aware. It's such a common need that I'd think that there might be enough reason to consider asking that SESI should consider providing such an animal in the Houdini tool-set.

I second this & I put this down in my post to the Houdini 10 thread. It will be nice to have a Move to Origin SOP but it will retain all the transformations plus attributes with options to compute the inverse direction etc.

After making the changes, you can append a Move to Original SOP which will put the geometry back where it came from. Or any particle system or geometry that's created relative to the geometry & the SOP will transform them there.

It will be great to see this in Houdini 10. :)

Cheers!

steven

Link to comment
Share on other sites

Just to be clear on this, I don't see how this can't be done as an HDA.

Spoken like a true programmer, Ed! ;)

Well, of course; you can build almost anything in HDAs, with VEX, Python, etc. You can use that argument about most of Houdini.

But there are advantages to making an HDK version out of it.. firstly, the speed and lower memory footprint - which can be significant if you're aligning thousands of objects. Secondly it just provides another useful tool to the artist and facilitates and suggest an alternate way of doing something. Many people might not have the idea that a tool like this would be useful, and even if they found out about this type of technique might not be able to build it themselves... people we like to call "artists".

Link to comment
Share on other sites

I got some time to play with this yesterday, but was only able to extract the positions, not the rotations. This was with the Object Chop. All I need now is something like an Orient constraint of sorts.

Any hints guys?

Alvin

Edited by GallenWolf
Link to comment
Share on other sites

I got some time to play with this yesterday, but was only able to extract the positions, not the rotations. This was with the Object Chop. All I need now is something like an Orient constraint of sorts.

Any hints guys?

Alvin

I don't know guys, but if these two teapots are topologically identical I would try use PointSOP for that purpose :)

Anyways...

1. http://forums.odforce.net/index.php?showtopic=7075&hl=

2. http://forums.odforce.net/index.php?showtopic=6993&st=12

3. http://forums.odforce.net/index.php?showtopic=6924&hl= (my example is wrong since it's based on one vactor transformation instead of two. Look on Simon's post explaining quaternions).

Edited by SYmek
Link to comment
Share on other sites

Actually, that was my TD side speaking. Since I assume GallenWolf is in production, it's most appropriate to note that it can already be done today.

Alright, I'll let you off on what I'll call a technicality this time ;) However, the spirit of what I was saying I find important.

Link to comment
Share on other sites

  • 6 years later...

It has been a long while :P

And today I had need of this, and decided to try again. I think I got it working!

 

 

It's barebones and not tested extensively (it's waay past bedtime!), would love to hear if there is something I missed!

 

I got the solution from: http://www.flipcode.com/documents/matrfaq.html#Q40

Q40. How do I use matrices to convert one coordinate system to another?

extractTransformMatrix_v001.hipnc

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