Saturday, December 21, 2019

3d - What are "view frustum", "focal length" and near plane distance?


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?



Answer



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).


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...