What's a good resource on field of view?

Started by
8 comments, last by Geometrian 13 years, 5 months ago
If I put in anything other than 45 degrees (the radians conversion of 45 degrees), then everything looks stretched in various ways. I can do a width/height aspect ratio; that stretches things towards the sides. I can do a height/width aspect ratio, except everything is stretched in the camera's X axis.
45 degrees is a horribly limited field of view, given the average human has a horizontal 105 degree FOV. How do I get better without the view stretching?
Advertisement
It sounds like you're doing something wrong somewhere, although I'm not quite sure what. Generally, you would set the aspect ratio for the projection to be the same as that of the viewport in which the camera is rendering; as for field of view, a typical value would be a vertical FOV of 60 degrees or so.

If with a typical setup you're getting noticeable distortion or stretching beyond what you see in other 3-d games, you're probably doing something wrong. Can you post a screenshot showing what you're talking about?
Quote:Original post by jyk
It sounds like you're doing something wrong somewhere, although I'm not quite sure what. Generally, you would set the aspect ratio for the projection to be the same as that of the viewport in which the camera is rendering; as for field of view, a typical value would be a vertical FOV of 60 degrees or so.

If with a typical setup you're getting noticeable distortion or stretching beyond what you see in other 3-d games, you're probably doing something wrong. Can you post a screenshot showing what you're talking about?

This is what I use to set the projection:
projection = Matrix.PerspectiveFov(fov, MainData.Display.Width / (double)MainData.Display.Height, near, far);

        public static Matrix PerspectiveFov(double fov, double aspect, double near, double far)        {            double yScale = 1.0 / Math.Tan(fov / 2);            double xScale = yScale / aspect;            return new Matrix(                xScale,         0,          0,                          0,                0,              yScale,     0,                          0,                0,              0,          far / (far - near),         1,                0,              0,          -near * far / (far - near),  0                );        }


This is an establishing shot at 90 degrees FOV:
Stretching1

This is an image from the same location, only with the mountain peak on the left side of the screen:
Stretching2

Images are larger than they need to be, but the distortion should be quite viewable.
All games have this distortion your seeing, theres nothing you can do about it.
Quote:Original post by rouncED
All games have this distortion your seeing, theres nothing you can do about it.

...I'd say it's strange I haven't noticed, but it really isn't.

I suppose I could study math for the next forty years, totally redesign the 3D system and get rid of the distortion...But that seems an overreaction. For one thing, by that time a bunch of other people will have probably redesigned it anyway. *Snark*

To clear up probably one last thing, am I seeing 60 degrees horizontal or 96 on my 1.6 aspect ratio monitor? It looks like 96.
Is this distortion less evident if the objects are further away from the camera? Does anyone know what causes the distortion in the first place?
Quote:Original post by stevenmarky
Does anyone know what causes the distortion in the first place?


If you measure the distance from your eye to the screen and the size of the screen, you can deduce what the FOV of your setup is. You'll find that the angle is generally too small to use in a game, so you'll want to cover a larger angle. The distortion comes from the mismatch between the angle the screen actually covers in front of your eye and the projection you are using. If you place yourself close enough to the screen so the it actually covers the angle that it should cover, there is no distortion.

Quote:Original post by alvaro
Quote:Original post by stevenmarky
Does anyone know what causes the distortion in the first place?


If you measure the distance from your eye to the screen and the size of the screen, you can deduce what the FOV of your setup is. You'll find that the angle is generally too small to use in a game, so you'll want to cover a larger angle. The distortion comes from the mismatch between the angle the screen actually covers in front of your eye and the projection you are using. If you place yourself close enough to the screen so the it actually covers the angle that it should cover, there is no distortion.

Could you calculate the FOV of the screen and do some sort of interpolation or other calculation between the two and get rid of the distortion?

Probably not, because it seems implicit in the FOV calculations - You'd simple end up reducing your FOV. I think.
Although maybe some kind of z-value adjustment to return a flat image instead of a "fish-eye" image...
Hi,
Quote:The distortion comes from the mismatch between the angle the screen actually covers in front of your eye and the projection you are using. If you place yourself close enough to the screen so the it actually covers the angle that it should cover, there is no distortion.
This is absolutely correct. Your distortion is due to the fact that although your eye sweeps out its 105° arc, it expects to see your game world as a small fraction of it's 105° field of view, corresponding to the smaller angle that the screen subtends.

Ideally, you'd want the center of projection to be at the viewer's eye for the FOV calculation, but there's no way of calibrating your user in this way! For this reason, it's generally accepted that you pick "what looks right". Usually, this works out to be around 40°-70°. I typically use 45°, and adjust as necessary.

-G

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement