wangdq
wangdq

Reputation: 1994

How U-V-N camera coordinate system explained with OpenGL?

I am confused of u-v-n camera coordinate system when deducing the model-view matrix specified by the function:

void gluLookAt(GLdouble eyeX,  GLdouble eyeY,  GLdouble eyeZ,  GLdouble centerX,  GLdouble centerY,  GLdouble centerZ,  GLdouble upX,  GLdouble upY,  GLdouble upZ);

if we call this function ,then we get a u-v-n coordinate system ,in which n = center-eye. it looks like this:

UVN Camera

And this u-v-n is left handle coordinate system .

parts confused me :

Can this u-v-n coordinate be the so called camera coordinate many books said ?

And I often read from some tutorial or textbook,said camera coordinate system is right-hand,so why we construct a left-hand u-v-n coordinate to deduce the model-view matrix specified by gluLookAt ,just for convenience ?

update

After reading your answer and investigation,I understood it this way:

1)u-v-n coordinate system is left-hand,and camera coordinate is right-hand,this is the fact.

2) when calculate the matrix,OpenGL will flip the n axis to -n instead,thus make it still a right-hand system,see gluLookAt API and GluLookAt code implementation for details.

Upvotes: 2

Views: 4297

Answers (1)

John Alexiou
John Alexiou

Reputation: 29244

To transform from camera coordinates to uvn define points T for target, C for camera and vector up for the up direction. The follow the steps below:

CS

where the norm() function normalizes a vector to magnitude()=1

Upvotes: 3

Related Questions