Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In 3d graphics, what is camera or eye space?

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.

like image 942
newprogrammer Avatar asked Jan 23 '12 00:01

newprogrammer


People also ask

What is camera space?

Camera space is the coordinate system from the camera's point of view. The origin of object space is at the object's manipulator. The manipulator's XY plane is always the plane of the camera, and the Z-axis always points to the camera.

What is 3D camera?

A 3D camera is an imaging device that enables the perception of depth in images to replicate three dimensions as experienced through human binocular vision. Some 3D cameras use two or more lenses to record multiple points of view, while others use a single lens that shifts its position.

What is viewing volume in computer graphics?

The volume of space that is actually rendered into the image is called the view volume. Things inside the view volume make it into the image; things that are not in the view volume are clipped and cannot be seen. For purposes of drawing, OpenGL applies a coordinate transform that maps the view volume onto a cube.

What is viewing parameters in computer graphics?

Viewing parameters are data and control information, specified by the application program, that determine the viewing transformation from 3D world coordinates to a viewport in normalized device coordinates. For example, the coordinate triplet defining a view plane normal is a viewing parameter.


2 Answers

Well, it's necessary to project a 3D world onto a 2D surface since your screen is a 2D surface.

3D graphics works in different "coordinate spaces", and these are converted between to get a final scene.

Imagine for example modelling a city. You might define the bottom left corner of the map as (0, 0), and the top right as (1000000, 1000000). You might also say that as a rule, one point will represent a foot of real space. This representation we will call World Space.

To draw your city, you'll want to import some models of buildings, and place them in the world. So you get your model of a building, but when you're making this model, you don't want to have to worry about the size of the world or where it will be - you maybe will say that the building's bottom left corner is at (0, 0) and its top right is at (1, 1). This representation we will call Model Space. In the world though, the building might be placed at (104, 136) and you might want it to be 1000x1000 pixels, so you will need to translate it to (104, 136) and scale it up 1000x. This is converting it from Model Space to World Space.

Finally, Camera Space is how you move around in the world. If you think about it, moving around in the world could be thought of in two ways (at least): You move around the world, or the world moves around you. So to make movement easy, we'll say that the camera is always at the point (0, 0) facing down some axis. Now if you want to move forward 10 pixels, instead you just move everything back 10 pixels. If you want to rotate, rotate the world instead. So to render the building, first we want to transform it from Model Space to World Space. Now, to actually draw it, we want to know where it is relative to the viewer, so we move it from World Space to Camera Space.

. . .

As an aside, if you want to understand this very well, a good exercise is to write a 3D wireframe renderer, separate from OpenGL. Your only drawing function available is DrawLine(x1, y1, x2, y2) which draws a line on the screen from (x1, y1) to (x2, y2).

like image 142
mindvirus Avatar answered Nov 15 '22 13:11

mindvirus


why it is necessary to project a 3d world onto a 2d surface

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.

I am not exactly sure what he means by camera space

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.

like image 21
Nicol Bolas Avatar answered Nov 15 '22 12:11

Nicol Bolas