Game Development Reference
In-Depth Information
How do we specify the degenerate triangle? The easiest way, shown in the following
diagram, is to duplicate the last point of the first strip and the first point of the
second strip. This yields four degenerate triangles (A3A4A4, A4A4B0, A4B0B0,
B0B0B1) but is preferable to making several draw calls. The dotted line in the
following diagram shows the extra degenerate triangles (which collapse to form a
line!) that join the strips together:
A 0
A 2
A 4
B 1
B 3
A 1
A 3
B 0
B 2
B 4
Index stream: A , A , A , A , A , A , B , B , B , B , B , B
0
1
2
3
4
4
0
0
1
2
3
4
Represents Four Degenerate Triangles
Specifying a model's color, UV, and normal streams
Just as with 2D rendering, there are a number of other stream types we can supply
to make the polygons we render look more interesting. We can provide both color
and texture UV streams in exactly the same way we did when rendering in two
dimensions, but we can also specify a third stream type called a normal stream .
In 3D mathematics, a normal vector is defined as the vector which is perpendicular
to two other non-parallel vectors, or in other words a vector that points in the
direction in which the polygon is facing. The following diagram shows an example
illustrating this:
Why is the normal stream useful? Well, it allows us to simulate the effects of lights
on our 3D model. By providing each vertex of our model with a unit normal (that is,
a vector that points in the direction of the polygon's normal and which has a length
of one unit), we can calculate the amount of light reflected from that vertex and
adjust the color it is rendered with accordingly.
 
Search WWH ::




Custom Search