0
\$\begingroup\$

I've been reading through "Mathematics for 3D game programming and Computer Graphics" lately. Specifically definition of the view frustum and how the APIs generally process it, author introduces the concept of a length e which he classifies as the focal length. And it makes absolutely no sense, isn't the whole notion of focal length incompatible with the pinhole camera concept (inf. small) which is at the heart of 3D APIs as Direct3D and OpenGL? I thought all I need is the aspect ratio, the distance from the near plane and the FoV which can be established from the distance from the near plane.

And then he simply drops it and speaks of near plane distance n, which I thought was the actual value of e. What gives? Isn't the distance from the near plane the same as the "focal length" since we're talking about a pinhole camera? How do they differentiate?

\$\endgroup\$

1 Answer 1

6
\$\begingroup\$

The focal length controls the field of view. That is, they're mathematical transforms of each other: changing one changes the other. The longer the focal length, the smaller your field of view.

So your FOV parameter is merely a re-stated form of the focal length.

The "common projection matrix" doesn't really use a focal length. The actual focal length is always the same. These matrices implement FOV as a scale applied to the X and Y camera-space coordinates. This is just to make the math easier; being able to keep the eye point at a fixed location makes the math simpler. But in terms of the results, either produces the same results.

Isn't the distance from the near plane the same as the "focal length" since we're talking about a pinhole camera?

No. The near plane is irrelevant; the near/far planes exist solely for near/far culling of rasterized triangles. They're important mathematically for computing the depth value (which ties into depth buffers), but they have no effect on the visuals of the scene (outside of depth buffer artifacts from having a close near plane).

\$\endgroup\$
4
  • \$\begingroup\$ this seems wrong, if you make your own projection matrix and alter nothing but the near plane distance, the view zooms in and out... right? \$\endgroup\$
    – user36169
    Commented Jun 17, 2014 at 2:52
  • \$\begingroup\$ I had the same issue as user36169. Problem was my projection matrix was transposed! Literature always says OpenGL is column-major but it's actually row-major in memory. \$\endgroup\$ Commented Dec 6, 2017 at 13:48
  • \$\begingroup\$ @HugoMaxwell: No, it's column-major. Generally speaking, if you look at what "literature always says" (and I mean real literature, not random tutorials on the Internet), and you feel that it's wrong, that's more likely that your understanding of things is what's wrong. \$\endgroup\$ Commented Dec 6, 2017 at 15:24
  • \$\begingroup\$ Yeah it depends what you mean by major. I thought major stands for the dimension which is incremented when incrementing the array index. But turns out it's a visual major and not a programmatic major. \$\endgroup\$ Commented Mar 6, 2018 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .