Jump to content

Orientation Matrix Help?


Justin K

Recommended Posts

Hello all, I am trying to get a firm grasp of orientation matrixes: special thanks

1) to tokeru,

2) this site

3) and this page here https://www.sidefx.com/forum/topic/6679/ for helping me get a  grasp of how the copy sop works with N, Up, and Orient.

Im getting it slowly, but now Ive hit well, a road block lol.  I have attached an example file.  Basically here is what I have:

I have a curve , and am attaching other  lines to this curve using a copy sop.  These curves have a stamped random noise, a stamped random scale,

and most importantly, an orientation attribute that forces them to wrap around the line at the angle I specify.  :D

Thing is  I want to do to 2 more things to these lines.  I want to be able to control their angle or orientation away from the curve, and I also want to be able to skin geometry along the lines as well, having the geometry skinning hold up if I do any rotations. 

Here is where it stands now (just head to attached if that makes it easier).   The following code is where I get my initial @orient info for the copy stamp.   I am using the transform within the copy sop to 'tweak things' (mostly likely the source of the problem).  

 

Wrangle 1:

@rotter = float(@ptnum)/float(@numpt);   //the incrementally increasing angle I will use within my quaternion.   In the following vop sop I fit this value between 0 and 360-- then promote the attribute.  

Wrangle 2 (after vop sop)

@angle = radians(@rotter);
vector axis = @N;       //this defines the main path (y axis?) of my line.  I tried  both @N --generated using polyframe tangent u, and just an arbitrary up vector (0,1,0)--both had issues
matrix3 m = ident();
 
rotate(m, @angle, axis);    //rotating around my specified vector
 
@orient = quaternion(m);   //promotion to usable attribute

 

It works great! Sort of. The way this is set up I have limited control over additional rotation, and cant control the axis during skinning. 

If I set the vector axis to the normal, then with no rotation within the copy sop, the skinning works at first.  When I rotate it though, the tubes start to flatten (see attached).  

 

Conversely, if I just use an Up vector (0,1,0), the skinning only works when there is not transform, and now the tubes point straight up!  Not what I want at all. 

Ill point out that this transformation in Z within the copy sop is actually perfect for this secondary rotation control, of only the skinning would follow suit.  

 

Okay!  My thoughts for a solution. I tried to build a new Up and N vector within the loop itself, but this did not seem to help.  Not sure if this is a precedence thing or what---after all the rules of the copy sop might not apply to skinning.  I then tried to generate a new orient attribute but this didnt work either.  I have a hunch that WAY back in time, my original orientation wrangle MIGHT need a bit more info.  

Any pointers would be great!   

Thank you

 

 

 

 

 

water_flower_v005_upl.hipnc

Link to comment
Share on other sites

Hi, I checked out your scene and updated it.

Quote

I want to be able to control their angle or orientation away from the curve

I added two angle values for yaw and pitch, which were then used in a rotate() function sequentially.

Quote

I also want to be able to skin geometry along the lines as well, having the geometry skinning hold up if I do any rotations. 

You still had the @orient attribute passing through the Sweep SOP. Simply delete that and let the sweep use the PolyFrame's tangentu as N.

H16.5.268 Indie - water_flower_v005_upl_jeff.rar

I hope this helps!

  • Like 1
Link to comment
Share on other sites

6 hours ago, galagast said:

Hi, I checked out your scene and updated it.

I added two angle values for yaw and pitch, which were then used in a rotate() function sequentially.

You still had the @orient attribute passing through the Sweep SOP. Simply delete that and let the sweep use the PolyFrame's tangentu as N.

H16.5.268 Indie - water_flower_v005_upl_jeff.rar

I hope this helps!

thanks galagast.  That was incredibly intuitive and helpful (thanks for the notes within the file as well).  

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