I am reading a book about 3D concepts and OpenGL. The book always talks about world space, eye space, and so on.
What exactly is a world inside the computer monitor screen?
What is the world space?
What is eye space? Is it synonymous to projection?
Before understanding what is the world or eye space, what is a space?
In an abstract sense, a geometrical space (e.g. Euclidean Space) is a boundless extent where objects tend to exist. The space defines basic properties that objects living in this space should satisfy. For example in euclidean space distance is defined as
Sqrt( vector dot product with itself).
Most people tend to mix between the definition of Space and Coordinate system. A space as euclidean space defines the properties but doesn't define the coordinate system, I would say "eye space" is better called "eye coordinates".
In computer graphic we almost exclusively deal with euclidean space. When you define a Vertex of (X,Y,Z) in euclidean space it doesn't mean anything as is to us.
A more tangible definition would be to define it relative to some coordinate system. For example a Vertex(X,Y,Z) is relative to eye coordinates. So if Vertex=(0,2,3) relative to the eye coordinates. it means that this vertex is:
- 0 in the X direction from the eye X position.
- 2 in the Y direction from the eye Y position.
- 3 in the Z direction from the eye Z position.
- And the vertex distance from the eye is sqrt(0^2 + 2^2 + 3^2)=sqrt(13) unit.
But what is eye coordinates and how do we define a coordinate system ?
We define a coordinate system by providing three orthogonal basis(read: unit length and perpendicular) vectors which resembles orientation, and a position(translation).
So if the camera in openGL was defined (note that this is relative to World coordinates):
- Position (0,3,10) - Up (0,1,0) - Forward (0,0,-1) - Right (1,0,0)
This means that the viewer is setting at (0,3,10) from the world (0,0,0) and his right is aligned with the world X axis, and his forward is reverse the world Z, and his up is aligned to the World Y.
But you talked too much about the eye coordinates, what is the World Coordinates?
World coordinates is just a fixed parent coordinate system. The eye coordinates itself should be relative to something. This is the global coordinate system that everything is defined relative to.
World Coordinate has a fixed i=(1,0,0) in the X direction, j=(0,1,0) in the Y direction, k=(0,0,1) in the Z direction. These are the vectors that define Cartesian coordinate system.
But that doesn't make sense! What is the coordinates that World coordinates is defined relative to?
I would say it's relative to itself, in reality that would be the center of the universe (but that's too simplistic).
But in a more practical sense, I would say in Computer Graphics it's convenient to define world space as the center of the universe (game world) so we can imagine how things can relate to each other.