Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

field of view

14 views
Skip to first unread message

bob smith

unread,
Feb 5, 2013, 1:55:20 PM2/5/13
to
I'm considering this function:

void gluPerspective(
GLdouble  
fovy,

GLdouble  
aspect,
 
GLdouble  
zNear,
 
GLdouble  
zFar);


Normally, I just pass in 45 degrees or 60 degrees for the first parameter, the field of view. However, I've been seeing some stuff that looks a little stretched. Can you just pass in 45 or 60 for the first parameter and expect everything to look right? Or should it largely be related to the width and height of the device?

Thanks.

Andy V

unread,
Feb 5, 2013, 7:25:40 PM2/5/13
to
On Tuesday, February 5, 2013 1:55:20 PM UTC-5, bob smith wrote:
> I'm considering this function:

> void gluPerspective(
...
> Normally, I just pass in 45 degrees or 60 degrees for the first parameter, the field of view. However, I've been seeing some stuff that looks a little stretched. Can you just pass in 45 or 60 for the first parameter and expect everything to look right? Or should it largely be related to the width and height of the device?

If the width/height ratio is >> 1 or << 1, I would expect some strangeness,
but for a ratio near 1, things should look OK. Perhaps you can post an
example of "a little stretched"?

--
Andy V

Nobody

unread,
Feb 5, 2013, 9:05:54 PM2/5/13
to
Ideally, the aspect parameter should match the ratio of the physical
dimensions (in millimetres, inches, etc) of the viewport, while the fovy
parameter should be 2*atan((height/2)/distance), where height is the
viewport height (i.e. the height of the window) and distance is the
distance of the viewer from the screen.

But that tends to result in fovy being far too narrow in many cases, i.e.
a "telephoto" view, particularly when the window is much smaller than the
screen.

The fact that a mathematically-correct perspective tends to look distorted
when an object moves away from the centre of view is well known. E.g.

http://www.handprint.com/HP/WCL/perspect1.html#distortion

suggests that anything a 60-degree cone is the practical upper limit, and
40 degrees is safer. Also, that article deals mainly with static art
(painting, photography), where the composition of the scene would tend to
avoid having objects of interest around the edges.

Applications (e.g. CAD) tend to use fairly narrow view angles.
First-person games which require a reasonable view angle to avoid
"tunnel vision" actually look quite bad if you're paying attention to the
perspective at the edges of the screen.

But the game mechanics (e.g. shooting at things) and the control
model usually encourage the player to keep objects of interest in the
centre of the screen and to keep their view focused there, using the
mouse/controller to move the view rather than looking around the screen
with their eyes. Also, they're normally using the entire screen rather
than a window.


bob smith

unread,
Feb 6, 2013, 10:55:53 AM2/6/13
to
I just realized that the first parameter is called fovy with a y at the end.

So it is the field of view in the y direction. For some reason, I always thought it was the x direction.

Also, I noticed the docs say:

For example, aspect = 2.0 means the viewer's angle of view is twice as wide in x as it is in y.

So, I guess it is okay to specify a first parameter that is a constant such as 60 or 45. I guess there's not necessarily a "correct" value there partly because you don't know the distance of the viewer's eyes from the screen. Also, partly because the viewer is probably not a cyclops and has two eyes, which are in two different positions.
0 new messages