View Full Version : Importance of View UP Vector?

screwtape

04-10-2001, 02:44 PM

Using gluLookAt, I can understand why we need the position of the eye (the first three values gives the point) and the direction the camera points in (the next three values), but I don't quite understand why we need the final three values, the view up vector? Later on I plan to experiment and see how it effects my objects, but if someone could explain it I would appreciate it. Also, does it have any restrictions, such as the angle between the two vectors must be < 90 degrees or something like that?

Thanks...

You need the up vector to tell you, well, which way is up. The direction in which you are facing simply isn't enough to fix your orientation.

screwtape

04-10-2001, 03:24 PM

Originally posted by rts:

You need the up vector to tell you, well, which way is up. The direction in which you are facing simply isn't enough to fix your orientation.

okay, thanks, I understand now, its simple enough that i feel stupid, but what about the restrictions? Is any angle between the two vectors acceptable? say I have a vector from the eye to the viewing position defined by the first two points; the second vector obviously would have to be less than 90 degrees, but does the actual angle effect the viewing at all?

The up vector is detached from your look vector. Up vector is relative to the world. LookAt() basically takes your look vector (looking at - standing at) crosses it with the world up vector this results in right vector then it crosses right with look to obtain new up vector. You have three vectors up, look and right that are then transposed and dotted with inverse of camera position vector to yield a new view matrix, I think http://www.opengl.org/discussion_boards/ubb/smile.gif Anyways, look into DirectX docs in the view matrix section and just transpose the 4x4 matrix to get it into opengl.

WELL actually, one needs only SIX degrees of freedom (DOF) to define the position and orientation of a rigid body in 3-space. http://www.opengl.org/discussion_boards/ubb/cool.gif

Now, a position vector, a camera view vector and an "up" vector has 9 DOF. (3 times (x,y,z))Yes, it's a little redundant, but it's easy. That's why most computer graphics implementations use it. http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

How can you do it with only 6 DOF? http://www.opengl.org/discussion_boards/ubb/confused.gif Well, it has to be the right 6. Using a globe as an analogy, first you translate it in space: that's three right there (x,y,z). Next, you need to find a position on the globe. That's two more: latitude and longitude or (say theta and phi). We need one more. But the globe can spin! http://www.opengl.org/discussion_boards/ubb/cool.gif So you need one more degree of freedom (say an angle psi). That's six. http://www.opengl.org/discussion_boards/ubb/eek.gif Again, this is not new to computer graphics but was worked out in physics in the 1800's as Classical Mechanics.

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.