x


Zooming a camera without distorting edges with POV changes

Right now i have a camera that i zoom in and out, but objects around the edges (when zoomed in as they look normal when zoomed out) seemed to get stretched and distorted. Is there a way to avoid this, while still using POV? If not, is there an efficient way of zooming without stretching objects on the edges of the camera visible fostrum?

more ▼

asked Apr 11 '12 at 06:05 AM

1337GameDev gravatar image

1337GameDev
526 43 49 54

Maybe set your camera to Orthographic , rather than Perspective. (depends on what you are doing [2D, 3D])

Apr 11 '12 at 08:58 AM alucardj

I'll test with different cameras if i have too, thanks for the suggestion.

Apr 12 '12 at 04:51 AM 1337GameDev
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Moving the camera is an unreliable solution, since it accounts poorly for geometry that might be in the way; the camera migh get moved beyond hilltops or the walls of houses and make you see behind things when zoomed which are in front of the camera while unzoomed.

Changing the FOV is the only reliable way to implement zoom, and thankfully, also happens to be what a real camera does when it zooms. :) A physical camera changes the focal length of its lens, which in turn changes the angle of view, which corresponds to the FOV of a computer graphics camera.

Also, increasing the field of view does not zoom in, it is the other way around. :) "Zooming in" occurs when the FOV is changed to something smaller than the camera's default "zoomed out" FOV. This makes intuitive sense, because the size of an object will take up more of the viewport's area, if the angle of view is smaller. Conversely, if the angle of view is greater, then the same camera will fit more of the world into its viewport, and thus, the individual object in the world must become smaller.

The distortion you describe sounds like what happens when the FOV approaches 180 - the perspective curves and becomes twisted? I'm not 100% certain what you mean by stretching and distorting when zoomed in, but perhaps this could be caused because you're zooming very close to 1 when you zoom in? Try to play around with the FOV with a camera in the editor and study the camera's frustum as you change the FOV. Notice that the view frustum becomes very long and thin when the FOV is low? This happens because the far plane is at the same distance from the camera, so to reach it with such a low FOV, the frustum must become a very thin, long pyramid. This means that vectors along one side of the frustum to the camera become almost parallel to vectors from the middle of the frustum to the camera, i.e., the camera basically approximates orthogonality at extremely low FOVs. Depending on how geometry is positioned relative to the camera, this might stretch the objects in the sides of the screen, because the camera's projection loses its perspective correctness.

Keep with the FOV solution for zooming, but perform the zooming within a range of values that are still comfortably far from 1 and 180. Something like zoomed out = 90 and zoomed in = 40, or maybe 60/30.

more ▼

answered Apr 11 '12 at 08:27 AM

CHPedersen gravatar image

CHPedersen
6k 13 22 61

OK, thanks Christian ... I think I'll probably delete my answer ... it was pretty bad :D

Apr 11 '12 at 09:36 AM Kleptomaniac

Thanks for the info! The distortion happens to an object on the edge when i'm zoomed in closer to the screen. Ill check my values, but what if those values arent enough to zoom in where i want? Then what should i do?

Apr 12 '12 at 04:53 AM 1337GameDev
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3009
x183
x152
x26
x6

asked: Apr 11 '12 at 06:05 AM

Seen: 783 times

Last Updated: Apr 12 '12 at 04:53 AM