Difference between revisions of "Discussion8S16"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(Mystery of the Orientation: Changed X axis ordering.)
(Mystery of the Orientation: Flipped Y ordering.)
Line 26: Line 26:
  
 
Now, finally we can find the final Y axis, by again finding the vector that is perpendicular to both the Z and X. Be careful of your ordering!
 
Now, finally we can find the final Y axis, by again finding the vector that is perpendicular to both the Z and X. Be careful of your ordering!
<pre>Y = normalize(cross(x, Z))</pre>
+
<pre>Y = normalize(cross(Z, X))</pre>
  
 
We can now complete this picture and find the basis vectors:
 
We can now complete this picture and find the basis vectors:

Revision as of 16:37, 17 May 2016

Overview

Week 8 Discussion recap(05/16/16)

Slides: Download here

Mystery of the Orientation

As we move our coaster along the track, not only do we have to translate it, we must rotate it to look natural as well. How do we achieve this?

Axisrotation00.PNG

Well, since rotating the whole pod should be achievable by rotating the toWorld, let's think of this in terms of the toWorld's axis.

Axisrotation01.PNG

Our goal is to transform the axis on the left, to the one on the future. This is looking very much like a coordinate transformation, much like what we did with our cameras! (If coordinate transform doesn't ring a bell, read up on the Projection lecture to see how coordinate transformation are defined.)

Remember that the coordinate transformation matrix can be found by finding the x, y, and z basis vectors and the translation. So how will we go about finding those x, y, and z?

First off z is most simple right? It's simply the direction our pod is moving down the curve. In other words, it will be:

Z = target - pos

Well, we're not quite done yet though. We have to normalize that Z so that we don't unintentionally introduce a scale factor.

Z = normalize(target - pos)

Next, between X and Y, which do we look for first? Think back to the order in which we calculated the Camera Matrix. Only one of these is certain from Z, and that's going to be the X vector. As long as our pod is staying upright, we can assume our up vector is going to be <0, 1, 0>, i.e. straight up in world coordinates. Given Z and up, we can find the vector that is perpendicular, to both of them, which will be our X vector.

X = normalize(cross(<0, 1, 0>, Z))

Now, finally we can find the final Y axis, by again finding the vector that is perpendicular to both the Z and X. Be careful of your ordering!

Y = normalize(cross(Z, X))

We can now complete this picture and find the basis vectors: Axisrotation02.PNG

Again, if you're not sure what to do with the bases once you've found them, refer back to the Projection lecture.

Point Control