computing the position-orientation of the camera

Hi
I have loaded the camera information from a COLLADA file. it contains of translation, rotation and scaling. So based on these transformations, I compute the local to world matrix and then compute the inverse of this matrix. finally I load this matrix using glLoadMatrix(). Everything is fine, but now I need to compute the position and orientation(At and Up vectors) of the camera.So how can I do this?

If you have a matrix that transforms from camera space to world space (c2w) apply it to point p_origin = (0, 0, 0) and vector v_up = (0, 1, 0) to get those values in world coordinates:

``````
Point  cam_at = c2w * p_origin;
Vector cam_up = c2w * v_up;

``````

Thanks.
But what about the camera position?

Sorry, my bad, i was thinking of cam_at as the camera position not the point the camera is looking at.
If you only have the camera to world matrix you can not recover the look at point, since the camera really is looking at all of the axis from its position through the look at point. In camera space the camera (usually) looks down the negative z axis, so you can pick an arbitrary point there or perhaps choose the midpoint between near and far plane:

``````
Point  cam_eye = c2w * p_origin;
Point  cam_at  = c2w * p_neg_z;
Vector cam_up  = c2w * v_up;

``````

where p_neg_z is e.g. (0, 0, -1) or (0, 0, -0.5 * (z_near + z_far))

Thank you my problem solved