Cartesian Coordinate System
In a Cartesian coordinate system there are three axes which are at right angles with each other. The three axes intersect at their origin. The three axes are generally defined as:
- X – axis to indicate a displacement in a positive direction to the right and a displacement in a negative direction to the left;
- Y – axis where a positive displacement is up and a displacement in a negative direction is down;
- Z – axis for a displacement in a positive direction is forward and a displacement in a negative direction is backwards.
We can represent a point in in 3 D space with the aid of a Cartesian coordinate system. This is done by writing the displacement of the point along each of the three axes in the following format (x, y, z). The x is the displacement along the x – axis, also known as the x coordinate, y along the y – axis, also known as the y coordinate and z along the z – axis, also known as the z coordinate. So if we want to describe a point located one unit to the right, two units up and three units forward it is written as (1, 2, 3). I started by pointing a point, but it is also possible to represent a vector as well as a vertex on a Cartesian coordinate system using the (x, y, z) format. A vector is something that has quantity as well as direction. A vertex contains positional as well as directional values or quantities.
Objects in 3D Space
An Object in computer graphics and especially video games is something like a car, a person or a weapon. It is generally something that plays an active part in a scene. Any object in 3D space can be broken down into triangles. Each triangle can be represented by three vertices (vertices is the plural of vertex). As mentioned before vertex is a point in space that has positional as well as directional information. If we change the vertices that represent a triangle we also change that triangle. If we change all the triangles which complements an object we also change the object in 3D space. It can therefore be said that a change in the vertices caused a change in the object in 3D space. Vertex processing is the process wherey each vertex of an object is transformed from 3D in virtual space to an image on a 2D coordinate system. This 2D image can be displayed on a computer screen or printed by a printer. Vertex processing is done in a vertex shader. The modern trend is to have vertex shaders that are programmable. This allows for greater flexibility in the rendering and display of the objects by a computer. Vertex processing does provide for the following steps:
Transformation can be done by translation, scaling and rotation.
Let's take the vertex (1, 2, 3) in 3D space described by a Cartesian …