parenting / stick object inside SOP

   3591   4   0
User Avatar
Member
52 posts
Joined: June 2016
Offline
Hi,
I'm looking for a way to attach several curves onto a parent one so that if i'm deforming the parent, the other curves moves with their parent point.

In a second time, I'd like to add a parameter to change to orientation of the curves aligned to the up vector of its parent.

I tried several things with matrices, but I don't have a good comprehension enough to make it work properly…
I've found this post https://www.sidefx.com/forum/topic/43131/?page=1#post-193704 [www.sidefx.com] to align my curves to their parent's point (up vector), but when I do some transformations, I get a small difference between what I got and what I should get…

Well, if someone can help me with this, it would be appreciated

Note : this is a simpler example file, but I can't use a copy sop and work with @orient, because I already have a big structure exported, so I need to achieve this inside the same SOP in vex of vops!

Thx !

Attachments:
growth_help_004_rotations_04.hip (397.9 KB)
tree_growth_rotation_vertical_to_trunk.gif (322.5 KB)

User Avatar
Member
1391 posts
Joined: Dec. 2010
Offline
If you don't need transformation data later ,You can simply use Point Deformer SOP to solving rotation problem ,Check Houdini's help.

However You can make a rotation matrix with your vectors –>
NOTE (up , forward and side are vectors from parent point in the main branch)

up.x -> m11
up.y -> m12
up.z -> m13

forward.x -> m21
forward.y -> m22
forward.z -> m23


side.x -> m31
side.y -> m32
side.z -> m33

Then multiply this to your global P attributes.
Just you should do all of this in the Zero World position or I think you should add some more setup for computing Translate and Pivot too.

Also there is some good tutorials about Inverse Matrix which can help you.
e.g

https://vimeo.com/214584753 [vimeo.com]
https://www.youtube.com/c/sadjadrabiee [www.youtube.com]
Rabiee.Sadjad@Gmail.Com
User Avatar
Member
52 posts
Joined: June 2016
Offline
Hi, thank you Sadjad for your answer.

I tried the Point Deform SOP, but this solution doesn't work with a single point.

I watched the tutorial you linked (thx by the way !), but I still don't understand the steps…

1) I have my animated trunk (transformation, or deformation like a noise, for example). I put a polyframe to get 3 vectors.

2) My 1st branch is on point 9; it has also polyframe.

3) I isolate my point 9 (from parent), create a matrix4 from the 3 vectors and the pivot point 9.

4) Then I move it to the origin ?

5) How do I apply the rotation to my branch ? Do I need to move it to the origin as well ?

I'm completly lost

Attachments:
growth_help_004_rotations_05.hip (392.7 KB)

User Avatar
Member
52 posts
Joined: June 2016
Offline
Hi, i'm still working on it, but I've found a post that could help :
http://forums.odforce.net/topic/19482-orient-rot-n-up-v-etc-instance-rotation-question/ [forums.odforce.net]

So I tried to do the same process, but at the end, I have an offset, and I can't figure out how to fix it so that my branch stays at the exact same position.

If someone as the solution, it would be nice

thx

Attachments:
growth_help_004_rotations_06.hip (224.8 KB)

User Avatar
Member
52 posts
Joined: June 2016
Offline
Well, I finally got it !!

I needed to create a rotation matrix of the parent point to get the orientation (in the copy SOP). The offset was corrected with the invert matrix of the parent point at the first frame (with a TimeShift).
So now, my sticking effect is working.

I provide the file if someone is interested.


By the way, I just ask : I'm using a polyframe to create the orthogonal axis, but it seems that the polyframe SOP doesn't work well on a straight line. It doesn't create the 3 orthogonal vectors.
Do anybody know how to create a “polyframe-like” on straight curve ? in VOP or VEX ?

And another question :
When I create a Line (Up vector, {0,1,0}), when I add a Wrangle node with :

v@x = {1,0,0};
v@y = {0,1,0};
v@z = {0,0,1};

if I put a transform node with random rotation, the vectors don't stay orthogonal, as if vectors were created in World Space. Should I create another matrix before ? or is there another way ?

Thanks !

Attachments:
stick_to_parent_08_working.hip (306.1 KB)

  • Quick Links