[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.9.2 Texturing

Our next challenge is texturing the sprite. To apply a two dimensional texture to the 3D sprite we need to flatten it. If we have 288 separate vertices (see section A Simple 3D Sprite), we can flatten the sprite any way we want, but when the triangles are sharing vertices we cannot separate them, and a flattened cylinder is sometimes difficult to texture. Either the sides will be curved or the ends will be flattened.

We probably want to texture the sides as a single rectangular area and each end as a rough circle. So we separate the ends from the sides. This doubles the number of vertices. Cutting one edge of the sides so it can be unwrapped adds two more vertices.

content/sprites/skin

Now we have 98 vertices instead of 48. This is a big hit, but it may be necessary to get the artwork done fast and well. Fortunately, we still have only 98 vertices instead of 288, but can we do better than that? Do we have to duplicate the 3D coordinates just because we need more texture coordinates?

We experimented with a system where the sprite had a different set of 3D coordinates (vertices), texture coordinates (texels) and vertex normals (for shading). For example: our cylinder could have each triangle connected to any 3 of the 48 unique vertices and any 3 of the 98 texels, instead of the current system where the triangle has 3 indices used for both vertices and texels. Unfortunately our approach proved awkward, slow and difficult to optimize.


This document was generated using texi2html 1.76.