dps27a
dps27a

Reputation: 101

Should I use the field of view or camera's z position for zooming in/out?

I have a large 2D plane of circles which I've been zooming in and out of (well TrackballControls has) using the camera's Z position (a PerspectiveCamera).

I recently added camera.fov to my DAT GUI controls to play around with it and found that I can fully zoom in and out of my scene using the range 0 to 180 for the field of view.

Which method should I use and why?

Edited:

There are multiple ways to make an object seem closer and further away from the camera:

To be able to smoothly scroll, using the mouse wheel, in and out of of a scene that contains large geometries (millions of vertices), is there a reason why I shouldn't or should use one of the methods above over the others?

Upvotes: 1

Views: 3158

Answers (3)

dps27a
dps27a

Reputation: 101

  • moving the camera's position = best option as it's more compatible with interaction
  • changing the camera's fov property = best option if you want to "zoom" in the true sense of the word, though doesn't play well with TrackballControls
  • changing the camera's zoom property = actually affects the fov value

Upvotes: 0

gaitat
gaitat

Reputation: 12642

There are two ways to zoom in/out. Either you move the camera closer/further to the object or you move the object closer/further to the camera. Which one you chose only depends on what else you want to do. So if you are in a city and you want to look closer to a car, well you are not going to move the city. But if you are examining things (different models) then it might be better to move the camera. (Maybe not very good example).

Upvotes: 1

GuyGood
GuyGood

Reputation: 1377

Well, if you change the cameras position you are not zooming at all, you are just moving it closer or further away.

Using the Field of View variable, you are zooming but this is usually related to a distortion if you get to the extreme values.

So it depends what you need for your application. If distortion is ok and you really need the feel of "zooming" in, you should be going for the FoV variable of the camera. If you need to avoid distortion and want to zoom in, you should better move along the "camera's lookAt vector". Then you could decide if you move the cameras target as you "zoom" or if you are slowing down the cameras movement if it gets closer to its target, a.k.a focus point. Just use what is suited for your use case.

Maybe some interesting stuff:

http://blog.tartiflop.com/2008/08/understanding-zoom-focus-and-field-of-view-in-papervision3d/

Upvotes: 1

Related Questions