Combined transformation of camera

Combined transformation of camera

Post by Giampiero Gabbian » Thu, 27 Mar 2003 16:38:28



Hi,
In the update orientation code of my camera, I wish to simulate the
motion of a viewer that can rotate about his X axis (climb movement) and
rotate about his view director (roll movement). The following is the
code I wrote and invoked in the actualRedraw() method of a Viewer
derived from SoQtConstrainedViewer. It fails when the movements are
combined, i.e. when the joystick position require both the climb and
dive transformation.
     // Calculate rotation matrix about X axis
     SbRotation dRot = SbRotation(SbVec3f(1,0,0),dive);
     // apply the rotation to camera orientation
     camera->orientation = dRot;
     // calculate the current view vector after rotation
     SbVec3f view;
     dRot.multVec(SbVec3f(0,0,-1),view);
     // calculate the rotation about the current view vector
     SbRotation rRot = SbRotation(view,joy.axisCoeff(0)*M_PI*time);
     // apply the rotation to the current up vector
     SbVec3f up;
     rRot.multVec(getUpDirection(),up);
     // update the up vector
     setUpDirection(up);
Is there anyone that can say to me what is wrong?
Thanks.
 
 
 

Combined transformation of camera

Post by Giampiero Gabbian » Wed, 02 Apr 2003 21:33:44


Giampiero Gabbiani ha scritto:
Quote:> Hi,
> In the update orientation code of my camera, I wish to simulate the
> motion of a viewer that can rotate about his X axis (climb movement) and
> rotate about his view director (roll movement). The following is the
> code I wrote and invoked in the actualRedraw() method of a Viewer
> derived from SoQtConstrainedViewer. It fails when the movements are
> combined, i.e. when the joystick position require both the climb and
> dive transformation.
>     // Calculate rotation matrix about X axis
>     SbRotation dRot = SbRotation(SbVec3f(1,0,0),dive);
>     // apply the rotation to camera orientation
>     camera->orientation = dRot;
>     // calculate the current view vector after rotation
>     SbVec3f view;
>     dRot.multVec(SbVec3f(0,0,-1),view);
>     // calculate the rotation about the current view vector
>     SbRotation rRot = SbRotation(view,joy.axisCoeff(0)*M_PI*time);
>     // apply the rotation to the current up vector
>     SbVec3f up;
>     rRot.multVec(getUpDirection(),up);
>     // update the up vector
>     setUpDirection(up);
> Is there anyone that can say to me what is wrong?
> Thanks.

This is the solution I found.

     dive = joy.axisCoeff(1)*M_PI*dt;
     roll = joy.axisCoeff(0)*M_PI*dt;
     // set the horizontal rotation axis as cross product between
     // the current UP vector and current VIEW vector
     SbVec3f view;
     camera->orientation.getValue().multVec(SbVec3f(0,0,-1),view);
     SbVec3f axis = getUpDirection().cross(view);
     // set up rotation matrix about horizontal axis
     SbRotation dRot = SbRotation(axis,dive);
     // VIEW vector rotation
     dRot.multVec(SbVec3f(0,0,-1),view);
     // set up rotation about the VIEW vector
     SbRotation rRot = SbRotation(view,roll);
     // apply new camera orientation
     camera->orientation = rRot * dRot * camera->orientation.getValue();

Just in case...
Bye

 
 
 

1. Camera Transformation vs World Transformation...Best one ?

Sorry about the previous posting... I forgot about the subject...

Hi There !

I was wondering what's the best for performances when moving a Camera
arbitrarily (Such as an HMD)

- Have the Camera Transformed by the current matrix returned "by the HMD"

or

- Have the whole scene (and take advantage of the caching) transformed by
the properly inverse matrix returned by the HMD.

I was wondering what's used with SoXtExaminerViewer when we twist the
objects arbitrarily with the mouse after 2/10 s or 3/10 s the rendering
time is really better (twice as fast). I'm thinking that moving everything
but the Camera is better. Any Suggestions.??.


The really weird part is when I am moving the the Scene from the same
application, (HMD off) with the SoXtExaminerViewer I'm sur I get a lot
more. I'm using OpenInventor 2.0.1. Triangles are smooth shaded, with four
different Materials.

Last thing: yaodl is what: Perf or OI... If OI how can we access the
stats ?

Stephane Morvan

*************************************************************************
*                  Clemson Design Methodology Group                     *
*                                                                       *
* Home          : (803)-639-3755  Office : (803)-656-7176               *

* WWW           : http://www.eng.clemson.edu/dmg/people/morvan.html       *
*                                                                       *
*************************************************************************

2. Blob modelling

3. Combine Object and Camera Matrix ?

4. Camera/view transformations

5. Camera transformations

6. camera transformations

7. Need help in 3D camera transformation!

8. Camera transformations

9. Ray Tracing: camera transformation

10. camera transformations using 4x4 matrices