camera zoom and fov

Blitz3D Forums/Blitz3D Programming/camera zoom and fov

Second Chance(Posted 2003) [#1]
Can anyone tell me what the camera zoom is based on? the docs say it defaults to 1, but 1 has no meaning reguarding real camera lenses. So 1 what? Obviously it's a relative measure, or maybe it means 1 radian. I seem to remember being able to control the cameras fov. Is this the same function with a new name?


DarkEagle(Posted 2003) [#2]
a camera zoom of 1 is no zoom
a zoom of 2 is 2x zoom
zoom of 4 is 4x zoom

etc.


sswift(Posted 2003) [#3]
Function SetCameraFOV(Camera, FOV#)
CameraZoom Camera, 1.0 / Tan(FOV#/2.0)
End Function


Mustang(Posted 2003) [#4]
Cool and handy little function there, Sswift! Maybe you should put it into code archives too?


sswift(Posted 2003) [#5]
Or, I could charge $10 for it!


Second Chance(Posted 2003) [#6]
That's great but it still doesn't explain the nature of the numbers. I know about camera lenses so it would be helpful to me if I could make real comparisons.


sswift(Posted 2003) [#7]
Sorry, can't help you there. I tried looking up what the FOV for a 35mm lens is, but it turns out that there's all kinds of factors which affect exactly what a 35mm lens can see.

Fov is pretty simple to imagine.

|
|
|
._______


That is a 90 degree FOV looking up and to the right. The dot is where the eye is.

A person, if you include their peripheral vision, has almost a 180 degree feild of view.

But the renderer will mess up if you try this, and anyhow you are looking right at the monitor, which is a small window... the monitor is not wrapping around your head.

A 90 degree view is more like human vision. And 90 degree angles in the game will look like they're 90 degrees, which is nice.

However if you're seated in front of the monitor looking at it, and it's about 2 feet from your face, and is 17", then if you were looking THROUGH it, like a window, then you'd only see like a 40 degree slice of view through it.

Now as far as lenses go, I'd say that your average 33mm lesn gives you something like a 90 degree feild of view, because I notice that when I take pictures with my camera it always looks like you're farther away from the subject in the picture then it seems when you're right there, and a 90 degreee feild of view in games will do that too.

If you want to simulate a wide angle lens, then you'll want to use like 120 degree feild of view.

And if you want to simulate zooming in on a subject, or using a narrow lens like a 10mm lens, then you'd want to use like a 45 degree or less feild of view.

I suggest rather than trying to come up with some arbitrary value based on lenses that you set your game up so you can change the fov in realtime from within the game, and print out the current value on the screen and try diffrent fov's to find the one that gives you the view that looks best. This is what I did in my tank game. It's very easy to choose a view which is too zoomed in or too zoomed out. Too zoomed in kills the impression of perspective, and feels like you're looking through a sniper scope. Too zoomed out makes the image distorted and the graphics seem to swim around as you turn and move the camera. Getting this right is important so you should visually confirm which setting is best, unless you're triyng to design an app for camera enthusiasts to use. :-)


Mustang(Posted 2003) [#8]
http://www.weather-photography.com/Techniques/lenses.php

According to this 90deg FOV = 24mm-28mm (camera focal length). And while human eye has (total) almost 180deg FOV, I think that only ~60deg of it is "sharp"... it's really hard to emulate human vision with PCs/CRTs perfectly because what you see in the monitor is 100% sharp everywhere. 90deg is a nice compromise.

Note that increasing FOV also increases number of polygons and "other stuff" visible, ie slows down the realtime rendering (more stuff to draw), and vice versa.


LAB[au](Posted 2003) [#9]
Most common value for fov is 64° which is the most conform to human vision, however I don't from where comes this value, just happened that in open inventor, vrml, etc... it was the default value.


Second Chance(Posted 2003) [#10]
Ok, great, now that everyone's learned about FOV, focal length, and Xmm lenses, can anyone tell me what FOV *or* focal length blitz's 1x zoom is supposed to simulate.

btw - just to add to the general info on this page. 35mm refers to camera film size, not lens size. So you could have a 100mm-35mm lens. Which just means a lens with a focal length of 100mm to use with a 35mm camera.


sswift(Posted 2003) [#11]
"Ok, great, now that everyone's learned about FOV, focal length, and Xmm lenses, can anyone tell me what FOV *or* focal length blitz's 1x zoom is supposed to simulate."

Well if you take my equation above there...

CameraZoom Camera, 1.0 / Tan(FOV#/2.0)

The important bit:
Zoom = 1.0 / Tan(FOV#/2.0)

We know Blitz' default Zoom is 1.0. So we substitute that into the euqation...

1.0 = 1.0 / Tan(FOV#/2.0)

Then we multiply both sides of the equation by Tan(FOV#/2.0) to simplify it...

Tan(FOV#/2.0) = 1.0

And then we have to get rid of the tan... So we take the arctan of both sides...

arctan(Tan(FOV#/2.0)) = arctan(1.0)

Which ends up being:

FOV#/2.0 = arctan(1.0)

And arctan(1.0) is 45, so...

FOV#/2.0 = 45

And them we multipy both sides by 2.0 to get the result:

FOV# = 90

So there you have it. Blitz's default zoom of 1 is equivalent to a 90 degree FOV.


sswift(Posted 2003) [#12]
"35mm refers to camera film size, not lens size. So you could have a 100mm-35mm lens. Which just means a lens with a focal length of 100mm to use with a 35mm camera."

Yeah but I have a digital camera so it doesn't have any film. Get with the times! Nobody uses film anymore! :-)


Second Chance(Posted 2003) [#13]
lol! Good point. Also, you're right, sorry I had missed the formula you posted. Thanks. Now I can stop being such a pain ;)