View Full Version : Camera placement
02-07-2010, 02:07 AM
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
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'.
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.
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 ;)
03-15-2010, 09: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...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.