[TexLand3D PIC] Chapter 6.   A Multitextured Landscape


This chapter's focus is on using multitexturing to make the landscape appear more natural, with less severe boundaries between the various textures.

The screenshot on the right shows a view of the TexLand3D application.

Multitexturing is the application of several textures to the same shape, a surprisingly versatile mechanism since it's possible to combine textures is numerous ways, especially when they have alpha channels.

The floor mesh (composed from quads) is covered with a repeating grass texture, completely replacing the geometry's underlying colour. A partially transparent stone texture is applied on top of the grass. The grass shows through in the areas where the stone texture is transparent.

A light map texture is modulated with the grass and stones textures to add shadows and light without the underlying shape requiring normals or a light-enabled material. TexLand3D can load a light map from an image file, or draw one at execution time.

The texture coordinates for the grass, stone, and light map textures are generated at runtime, and the code can be easily tweaked to adjust the repetition frequency of each texture. For example, in the screenshot the grass texture is repeated 16 times, the stone texture 4 times, and the light map appears once.

Multitexturing is used to 'splash' purple flowers and pools of water onto random areas of the floor. A SplashShape object is made from quads copied from the floor mesh, and covered with a combination of a standard texture image and an alpha map texture. The map specifies what areas of the standard texture will be opaque, translucent, and transparent. Each SplashShape generates its own semi-random alpha map at runtime, which produces unique borders for each shape's flowerbed or pool. My SplashShape class owes a great deal to David Yazel's SplatShape class, and Justin Couch's AlphaDemo class.

TexLand3D illustrates the utility of a heights map for constructing a landscape. Heights for the floor's vertices are generated using a hill-raising algorithm, and stored in a 2D array of floats. This array is employed by the MultiFloor object to create the multitextured floor, by each SplashShape object to copy floor quads, and by roaming balls to navigate over the landscape (four of them can be seen in the screenshot).




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page