Sign in to follow this  

Problem with gluLookAt and path.

This topic is 4022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I have a 3d scene. My camera is flying trough this scene using path. This path is an array of vertex coordinates (z,y,z) and i'm using gluLookAt function here. My problem is that the fov is not stable and i know why, but i can't solve it. Please look at the pseudo: vector3f eye_pos = path_array[ i ]; vector3f look_at = path_array[ i + 4 ]; glLookAt( eye_pos, look_at, up_vector); If i'm right, the distance between position at [i] and [i+4] is not constant. And as a result i can't get the smooth flying effect. I'm right ? Please, give me some advices about this things. n.b.: this path array was taking from the obj file, that was maded by our designers.

Share this post


Link to post
Share on other sites
Quote:
Original post by limpacp
Hello!

I have a 3d scene. My camera is flying trough this scene using path. This path is an array of vertex coordinates (z,y,z) and i'm using gluLookAt function here. My problem is that the fov is not stable and i know why, but i can't solve it.
Please look at the pseudo:

vector3f eye_pos = path_array[ i ];
vector3f look_at = path_array[ i + 4 ];
glLookAt( eye_pos, look_at, up_vector);

If i'm right, the distance between position at [i] and [i+4] is not constant.
And as a result i can't get the smooth flying effect. I'm right ?

Please, give me some advices about this things.

n.b.: this path array was taking from the obj file, that was maded by our designers.
I'm not sure what you mean by the 'fov not being stable', but other than that it seems you're asking how to move a camera smoothly (and perhaps at constant speed) along a path.

With a path represented as a parametric curve, you can achieve both smooth motion (easy) and constant speed (a little harder). If all you have is a sequence of control points, you may need to first somehow fit a spline or series of splines to these points (there may be other solutions to this problem as well that I'm not thinking of at the moment).

Also, keep in mind that if at any point the path is parallel to the direction of up_vector, the 'look at' algorithm may fail. If the path is constrained such that you know this will never happen, you don't need to worry about it. Otherwise you might look into using a parallel transport frame rather than a fixed reference frame.

Finally, this topic is only tangentially related to OpenGL. If you need help with the parametric curve aspect of the problem, you'll probably have more luck in Math & Physics (maybe a mod will move this there).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What do you mean the *fov* is not stable?
'fov' refers to the number of degrees that the view frustum covers -how wide angle your lens is. -ie zoom
gllookat Should Not be altering your camera's zoom; all it does it aim it in different directions.
I think perhaps we have a confusion of the terminology here?

Maybe you meant that the camera itself is unstable? as in jerky motions?

Share this post


Link to post
Share on other sites

This topic is 4022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this