PDA

View Full Version : Camera placement



Irena
02-07-2010, 02:07 AM
Hello,
I have a mesh as a set of surfaces,described by vertexes
I need to place the camera so,that while doing perspective projection I`ll get the best "picture".
How can I do it?
(I can`t rotate /traslate etc. camera - just place it once)

Thank you in advance for the answers

mikeynovemberoscar
02-15-2010, 10:51 AM
Well in OpenGL there is no 'camera'. The 'camera' is always at 0,0,0 facing 0,0,0.
You have to translate your scene into the camera's view.
You may also want to look at 'gluLookAt'.

Jedimaster
02-23-2010, 10:18 PM
If your mesh is from DCC software such as 3dsmax or Maya and you want to render your scene from one camera, you can just write down its world position and fov such that parameter and use gluLookAt and gluPerspective to do what you want.

nickels
03-11-2010, 12:28 PM
Set the lookat value to be the mean of all the vertex positions.
Find the smallest eigenvector of the covariance matrix :D and set the camera along the mean - this eigenvector such that the field of view covers the scene.
There are some minor details to work out, of course ;)

nickels
03-15-2010, 08:23 AM
I should mention that the details concerning the covariance matrix are nicely presented in:
Real-Time Collision Detection (The Morgan Kaufmann Series in Interactive 3-D Technology) (Hardcover)
This would be a way to make sure you set the camera to view the broadest dimension of your scene...