Jump to content

Orient, rot, N + up, v etc: Instance rotation question


Ole

Recommended Posts

Hello!

 

I am currently trying to wrap my head around being able to transform (rotate) instance objects for sop copy and instance rendering. Basic stuff, I know, but I'm stuck and my math suck. I have a hard time grasping dot product, cross product, matrices and quaternions -> 3D transforms  :blush: There are, as far as I can see, a multitude of attributes and options to do this, and I am wondering what would be best suited for my use? Some use up, some use orient. Basically, I would like to have the rotation options of the transform sop (x, y, z rotate) to work on a point instance where the normal direction is the "up" direction (think teapots standing on a displaced ground plane, rotating planar to the ground when editing the y axis). I've been through a lot of examples but I just can't make them work for my scene. Either the objects are flipped or rotation is happening on the wrong axis or objects are not rotating smoothly, or I am not able to figure out how to "flip" to the right axis when using N and up (usually +-90 degrees in x) inside the vop. Most of all, it needs to be stable on deforming geometry. Any example of rotation working in this scenario would be most welcome!

 

Also, if you have a link to a good (basic level) resource regarding this topic, that would be awesome!

 

 

Thanks.

Edited by Ole
Link to comment
Share on other sites

Sooner or later you will have to have a decent orthogonal frame of reference either as a matrix3 or orient (quaternion). N, up etc are good for basic copy/instancing. How you can get this frame is another problem depending on your case. PolyFrameSOP or computed manually etc. Using orient seems to be the most straightforward, but it's just another version of N and up combo (cleaner, because you can do math on it, either with quaternions or matrices).

 

Basics attached. 

dancing_teapots.hip

  • Like 4
Link to comment
Share on other sites

Thanks for the link dpap, I'll have a look as soon as I get the chance.

 

Sooner or later you will have to have a decent orthogonal frame of reference either as a matrix3 or orient (quaternion). N, up etc are good for basic copy/instancing. How you can get this frame is another problem depending on your case. PolyFrameSOP or computed manually etc. Using orient seems to be the most straightforward, but it's just another version of N and up combo (cleaner, because you can do math on it, either with quaternions or matrices).

 

Basics attached. 

 

Thank you for the example, symek. Do you have a suggestion as to how xform1 can be removed, so that it is not necessary to pre-rotate the instance object?

Link to comment
Share on other sites

Thanks for the link dpap, I'll have a look as soon as I get the chance.

 

 

Thank you for the example, symek. Do you have a suggestion as to how xform1 can be removed, so that it is not necessary to pre-rotate the instance object?

 

Sorry, I'm a lazy bastard. It's actually a good example why quaternion/matrix are nice to work with.

dancing_teapots_prerotate.hip

  • Like 3
Link to comment
Share on other sites

Sorry, I'm a lazy bastard. It's actually a good example why quaternion/matrix are nice to work with.

 

Woah! I would never have guessed that was the way to do it. No wonder I never got it right..  :( Thank you again for the wonderful example. It was really helpful and an eye-opener :)

Link to comment
Share on other sites

Sorry, I'm a lazy bastard. It's actually a good example why quaternion/matrix are nice to work with.

 

I just noticed that using this method (PolyFrame), some of the instances 'pop' while rotating  :)

Edited by Ole
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...