Book nr. 1 : Focal Length #1412
Replies: 3 comments 1 reply
-
Hi @lucabicego, First thing to note, this camera created here isn't physically accurate.
This equation right here leaves us with negative focal_length, since all of the other vec3's don't have a Z component. Thus the focal length is -1, and the spheres center is -1. This frames the sphere nicely. If we "decrease" the focal length to 0.5, the calculated focal length is -0.5, meaning it's half the distance to the sphere, and thus the sphere appears further aways. The opposite is true when you "increase" the focal point to 2.0. The calculated value is -2, which is behind the sphere, and thus the sphere appears larger. Again, this modeled to be a real world camera, but it does follow the same patterns as a camera. I.e, a lower focal length the subject is further away, larger focal length the subject is closer:
|
Beta Was this translation helpful? Give feedback.
-
Focal length is an actual length/distance, and so is always positive. Direction is irrelevant. Put another way, the projection geometry is unchanged by moving or rotating the camera. |
Beta Was this translation helpful? Give feedback.
-
@lucabicego — in its simplest terms, the camera is just a rectangular "viewport" and its corresponding projection point. Scene rays originate from the projection point through some arbitrary point inside the viewport. If the projection point is infinitely far away, then you can imagine all of the rays going through the viewport parallel to each other — the "beam" of all rays is as narrow as it can be, and only objects inside that beam will be visible. As the projection point moves closer to the viewport, the "beam" widens, capturing more and more of the scene on the other side of the viewport. The viewing angle is the resulting angle of this beam, so that a larger angle (wide angle) makes things rapidly appear smaller the further they are from the viewport. This corresponds to a short focal length. A long focal length correspondingly yields a narrow (zoom) viewing angle, so there's less of a size difference between near and distant objects. |
Beta Was this translation helpful? Give feedback.
-
Hi,
i did some test on the code that you find on chapter nr. 5.2 of the book 'Ray Tracing in One Weekend'.
I used some values of the focal length to better understand what happen to the final picture. I used the values 0.5, 1 and 2. What i noticed is that with a focal length of 0.5 the picture of the sphere is little (see the first sphere on the left of the following picture) and if i use a focal length of 2 the picture of the sphere is bigger (see the sphere on the right). I tought to obtain the oposite ie with a little value of the focal length to obtai a bigger picture of the sphere. I don't understand why i get such a behaviour.
Could someone try to explain me it ?
Thanks.
Luca Bicego
Beta Was this translation helpful? Give feedback.
All reactions