Triangle Strips and Gouraud Shading
All the game geometry in OpenGL is decomposed into triangle
strips. For example, a cube with six (quad) sides becomes triangu-
lated with 12 sides.
The final quality of the object is directly related to the precision
with which it is modeled and textured. The game engine is the
interpreter of the 3D world, including the light, objects, textures,
animation, effects, and the background programming that will run
everything.
Here are some considerations for modeling using OpenGL:
4
OpenGL will decompose the quad polygons into triangles
before rasterization (rendering). It is recommended that you
provide a triangulated model so you don’t get unpredicted
results.
4
Avoidmodelingwheretwotrianglesshareanedgewith
another triangle, called a “T-intersection” or “T-vertex.” This
can cause unwanted cracks in the mesh, especially during ani-
mation.
324
Chapter 13 – Modeling for Games
Figure 13-1: Left, a simple cube primitive shown in Gouraud shading mode.
Right, when the same light is decomposed into 16 colors on the surface of
the cube, we can see how the light is processed and how the Gouraud
shading calculates the light starting from the vertex corner.
4
When viewed from outside, the orientation of the polygons of a
surface should point in the same direction (clockwise or coun-
terclockwise). This way, OpenGL will provide methods for face
culling manipulation and display, which can be useful when
dealing with convex surfaces and drawing the front faces and
back faces of a polygonal surface.
The OpenGL documentation available at opengl.org indicates tech-
niques about triangle-strip layouts that can speed up the OpenGL
mode and save data storage space. Since most 3D applications use
or allow the use of OpenGL resources with a 3D card, this informa-
tion can be invaluable if you are going to model and fix triangulated
geometry. If the polygonal mesh is directly generated from regular
geometry such as NURBS surfaces, it is recommended that you
connect the triangles into longer strips. One of the major rules
about triangulation of the mesh refers to the clockwise or counter-
clockwise orientation of the triangle strips. The first triangle can
start with either clockwise or counterclockwise winding, but the
subsequent triangles must be alternated according to the orienta-
tion of the anterior triangle.
325
Chapter 13 – Modeling for Games
Figure 13-2: A T-intersection at point A.
Figure 13-3: Alternated triangle strip.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.50.252