Mapping the Textures

The key to making this stuff look good is the q3map routine that works with alphamap and the metashader (see below) to smoothly blends textures across the terrain entity.

Texturing Overview

As noted earlier, Q3Map assigns textures, or more correctly, shader manipulated textures, to each triangle used to create the terrain map. The shaders used are part of a group of shaders called a metashader. The metashader is the family name for the shader. Individidual shaders within it are identified by a suffix, either an underline character followed by a number, or an underline character followed by a string indicating a blend between two other shaders.

Within the body of the metashader, there are two types of shaders used. The first, is the root shader. A root shader represents a terrain texture in its unblended state. The naming convention for a root shader is <metashader>_#. The second type is the blended shader. The blended shader creates a crossfade between two root shaders across the face of a single geometry triangle. The naming convention for a blended shader is <metashader>_#to#. The map maker does not need to make a blend between each root shader, but for a blend to occur, there must be a blend shader for the two root shaders.

Q3map will map a shader (root or blended) once and only once across the face of the triangle. The shaders will not tile or repeat across the triangle face.

As noted earlier, the textures are planar mapped or projected on the surface of terrain texture. The angle of any individual triangle does not affect the angle or direction at which the texture lies on the brush surface. The angle, however, does affect the apparent stretching of the texture on the surface. The steeper the angle of the brush surface, the greater will be the stretch of the shader on that surface.

Q3map looks at the pixel on the alphamap that corresponds to a given vertex. It uses the color of that pixel (or more correctly the identification number of the position that color occupies in the palette) to determine which root shader will be applied. That root shader is applied to triangles that have one vertex located at the given vertex. It then examines the alphamap color of the vertexes adjacent to the given vertex. If an adjacent vertex has the same color as the given vertex, the root shader is applied to the surface. If an adjacent vertex has a different alphamap color, the blended shader that crossfades between the two.

Back - Table of Contents - The Meta-Shader

-20-