A Primer to 3D Graphics - Part 1
Much have changed with PC graphics. Gone are the days
of where most of what we see in our screen are 2D images,
animation and video. In the last five years, 3D graphics
became less of a buzzword and more of a reality, so to
speak. Nowadays, we hardly see a new graphics chip without
some 3D graphics capabilities built in. Even the graphics
we're seeing in our cellular phones and hand held devices
are moving to 3D.Through the years, we see the overall image quality improve. Better images and animation are now the standard, made possible by more capable and faster hardware. In fact with every new generation, the tech demos gets closer and closer to cinematic quality, the holy grail of real time graphics. No wonder more and more attention have been given to 3D graphics, particularly in the area of real time consumer 3D graphics.
Computer Graphics 101
Before we delve deeper into 3D graphics, we should take a look how they are made possible. Undeniably, computer generated graphics are very closely related to math. Unlike drawing with a pen on a piece of paper, we worked with virtual ones. In this case, the virtual paper is the screen. Drawing a line is simple enough: put our virtual pen in one of the dots and move the pen towards the other dot. Slopes and curves are drawn much in the same way, although more calculations are needed.
With PC graphics, we must provide the dots' positions to the computer. So we divide the screen into a coordinate grid, by what we call the coordinate system, like in your basic geometry. We now have two axis - x and y - where x is the horizontal axis and y is the vertical axis. The height and length of the screen can be any number (or even infinity), but most of the time we use the number of pixels - resolution. For a screen resolution of 1024 x 768 pixels, most likely we're going to use 1024 as the maximum number on the x axis and 768 for the y axis. Since the pixels are square objects, we use the same unit for x and y. Of course, these numbers may have decimal values to allow more precision. Now we just need two coordinates (x,y) for our dots and then begin drawing our straight line.

If both dots share the same number on a given axis (for example 20,5 and 20,10), we have a line that's parallel to the axis (in our case its the x axis - 20). If they don't, we have a sloped line, either downwards or upwards. When we view the line, usually we don't see it as a line connecting two dots, but just a line. For example, when drawing, we draw the first dot and then move our pen to the second one. This method of drawing is actually called vector drawing. As you can see, we can draw a vector either by providing coordinates for both dots or we could use the coordinate of the first dot, the direction and distance of the vector. Using vectors is preferred since we can store a lot more information inside a vector and use it to draw a straight line or curve. There are other advantages as well, but we'll get into that later.

We could make all kinds of shapes using simple lines and curves. We could make a box, square, triangle or even complicated objects such as a pentagon, hexagon, ellipse or circle - whatever you like. These complicated shapes are mostly made up of lines and curves.. So, we can draw them just by using dots and connecting them. But more importantly, we can also draw them using a reference dot in the center and then draw the other dots in reference to the center dot.

Why is this so important? Look at a circle - you can't draw a circle with dots. The easiest way to a draw a circle is to draw a curve around the center (our reference center dot), to which every part of the curve has the same distance to the dot. Drawing an ellipse can be done in the same way, just use stretch the distance to get that ellipse shape. Defining a shape with vectors allows us to easily perform rotations and scaling. For example, to rotate a shape on it's center axis, just rotate the vectors in relation to the center. We can also scale the shape by increasing the distance from the center. Is that all? No, let's go wild - we could rotate and scale it arbitrarily in relation to any dot, even one outside the shape!
[Previous Page]
[Go to top]
[Next Page]