Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
89 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Who these
 papers are for

 Introduction
 Coordinate
 Systems

 Primitives
 Conclusion

 Printable version

 


Primitives

Now that we have a coordinate system to work with, let's start seeing how we can define objects in the system. There are three basic primitives we are going to use – points, lines, and triangles. Let's discuss each of them separately.


Figure 3 – Points, Lines, and Triangles in 3D

A point is the simplest primitive there is. Any position in 3D space can be defined by a point using three values (x, y, z). While this should seem obvious, make sure you understand this before you move on.

As in 2D space, a line in 3D space is defined by two unique points. Take a look at Figure 3b. Here, you can see an arbitrary line defined by two points. Before you go, "Yeah, yeah, I know what I line is," notice that since the line is defined only by points, you can change the line by simple moving one of these points. This is a very important concept to understand, since later on we are going to move everything in our 3D universe by moving individual points.

The final primitive we are going to look at is a triangle. Triangles will be the heart and soul of our 3D engine since all of the objects we are going to build will be modeled using triangles. The reason we use triangles instead of more complex polygons is because triangles have a lot of implied characteristics that other polygons do not. First, a triangle is guaranteed to be coplanar. This is obvious when you realize that a plane is defined by three points, and so is a triangle. Second, a triangle is guaranteed to be convex. If you are unfamiliar with this term, look at Figure 4. A convex polygon is basically a polygon with no "dents" in it. The reasons why this is important will become clearer later on. For now, just accept this as a nice feature of triangles.

 

Figure 4 – Convex Polygon (left) vs. Concave Polygon (right)

You may think that using only triangles is too limiting., but it's not. Any coplanar polygon can be broken down into triangles. This is called triangulation. In fact, most 3D accelerator cards work only with triangles, so by using triangles natively in your engine, you can work at a level better suited for these cards.





Next : Conclusion