Jump to content
Ole

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

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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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 4

Share this post


Link to post
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 :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

The way you provide stable frame is another question. PolyFrame relies on primitives topology. Do you have particular case to show the problem?

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×