3D Game Programming All in One (Course Technology PTR Game Development Series)

Many structures have large surfaces with repeating patterns. The best way to approach making textures for these surfaces is to create one smaller texture that is replicated many times across the surface, rather than simply making one large texture.

The replication will usually take place in two dimensions. It is important to make sure that the edges of the texture align properly when they meet. Figure 11.15 shows this to good effect. You can see the obvious horizontal as well as the more subtle artifacts in house A where the tiled brick textures don't quite line up. In house B, where care was taken to ensure that the texture edges matched up correctly, those artifacts aren't visible.

Figure 11.15: Tiled brick texture.

However, in house B in Figure 11.15 there is another obvious artifact of tiling, this time caused by asymmetric lighting effects in the texture shading. You can see each repeated texture tile—its position is marked by the presence of the darker shaded bricks in a repeated pattern. This effect can be quite subtle and difficult to detect in an image viewed in isolation.

Figure 11.16 shows the texture used in house B of Figure 11.15. Looking at it in isolation, you would be hard pressed to notice the subtly darker shaded bricks.

Figure 11.16: The brick texture with asymmetric shading.

The simplest way to fix up a texture for use as a tiled texture is to copy the left edge, about 5 or 10 pixels wide, mirror the copy horizontally, and then paste the copy on the right side of the image. Do the same for the bottom edge. Of course, you can go from top to bottom or right to left as well. The important step is the mirroring.

After placing the mirrored edges, spend a little time blending their inner edges with the interior portions of the image.

Figure 11.17 shows a stone block texture that is a candidate for use in a tiling situation.

Figure 11.17: A stone texture.

Figure 11.18 shows the texture tiled in a set of four. Again, you can see the artifacts caused by the mismatched edges.

Figure 11.18: Poorly tiled stone texture.

Figure 11.19 shows the left edge being copied, mirrored, and placed on the right.

Figure 11.19: Replicating the left edge.

Figure 11.20 shows the same thing happening with the bottom edge.

Figure 11.20: Replicating the bottom edge.

Finally, Figure 11.21 shows the tiled result.

Figure 11.21: Properly tiled stone texture.

Категории