I’m trying to learn 3d graphics programming through “Learning Modern 3D Graphics Programming” by Jason L. McKesson.
I have not really looked at other guides, but this guide seems to emphasize the theory and mathematics behind 3d graphics. Right now, I am stuck on this page:
http://www.arcsynthesis.org/gltut/Positioning/Tut04%20Perspective%20Projection.html
I am not exactly sure what he means by camera space, and why it is necessary to project a 3d world onto a 2d surface. This question is kind of vague, so instead of a full explanation, links that might give me a different way of explaining these concepts would be appreciated as well.
All graphics is just 2D images. 3D graphics is thus a system of producing colors for pixels that convince you that the scene you are looking at is a 3D world rather than a 2D image. The process of converting a 3D world into a 2D image of that world is called rendering.
A projection, for the purposes of rendering, is a way to transform a world from one dimensionality to another. Our destination image is two dimensional, and our initial world is three dimensional. Thus, we need a way to transform this 3D world into a 2D one.
Before this point, vertex positions were expressed directly in clip space. Recall that the divide-by-W is part of clip space vertex positions. Perspective projection is a way of transforming positions into clip space such that they will appear to be a perspective projection of a 3D world.
This transformation process has well-defined outputs: clip space positions. But what exactly are its input values?
That’s camera space.
This is not a space that OpenGL recognizes (unlike clip-space which is explicitly defined by GL); it is purely an arbitrary user construction. However, it can be useful to define a particular camera space based on what we know of our perspective projection. This minimizes the differences between camera space and the perspective form of clip space, and it can simplify our perspective projection logic.