Game Development Reference
In-Depth Information
Table 8.1 Raw Geometry Sizes
Object
Members
Size
Vertices
2,000 points @ (3 floating-point
numbers x 4 bytes each).
24,000 bytes
Each triangle group
300 triangles @ (302 indices x
2 bytes each).
604 bytes
All triangle groups
100 groups @ 604 bytes = 60,400
bytes. Vertices @ 24,000 bytes +
Triangles @ 60,400 bytes.
84,400 bytes
three vertices. This way you can store n triangles with only n+2indices instead of
n*3 vertices
quite a savings.
Let
s assume you have an object with 2,000 vertices: 300 triangles stored in 100 trian-
gle groups. Take a look at Table 8.1 to see how much space this data takes.
It looks like you can store the raw geometry in about 82KB. But wait, there
'
'
s a little
more data to consider. The data doesn
t tell you anything about how to texture the
object. Renderers will assume that each triangle group has the same material and tex-
tures. For each group, you ' ll need to store some additional data.
A material describing the diffuse map is going to define the color of an object and
how it reflects light. The size of the material can vary, depending on what the gra-
phics chip and renderer can handle. The renderer can also apply one or more tex-
tures to the object. This data can vary in size. If the object is unaffected by lighting
and has a solid color, it will require only a few bytes. If the object is affected by light-
ing and has a base texture, a decal texture, a normal map, a specular map, an envi-
ronment map, and stores color information for ambient, diffuse, and specular
lighting, then it could require almost 100 bytes per vertex. This information is stored
for each index in each triangle group.
Let
'
'
s look at two cases, shown in Table 8.2. The first has a simple textured, colored
object, and the second has an additional 64 bytes per index in each triangle group to
store material and lighting data.
Notice the staggering difference. The more complicated object is quite a bit larger,
but it also looks amazing. So what have you learned? The complexity of the geometry
can be made much smaller if your 3D models make good use of triangle strips and
fans, but most of the savings comes from being frugal with complicated material
Search WWH ::




Custom Search