Terrain-related WorldSpawn Features

A number of worldspawn key/value pairs were created to deal with issues arising out of terrain creation.

Cold Breath and Hot Dust

The following two features need not be directly related to terrain, although they first appear in the Q3:TA maps. Each key/value pair needs to be the worldspawn for that particular feature to work.

Key/value pairs:

Key: enableBreath

Value: 1

When written into the worldspawn, this enables the appearance of “frosty breath” in the air in front of players. The frosty break does not appear in a player’s first person view, but will be seen in front of other players and in 3rd person view.

Key/value pair:

Key: enableDust

Value: 1

When written into the worldspawn, this enables the appearance of dust puffs at the player’s feet when he lands on or run on a “dusty” surface. Adding the surface parameter “surfaceparm dust” to the shader for that surface creates a dusty surface. The common/terrain2 texture already contains the enableDust parameter.

Texture Remapping: Shaders for vertex light mode in Q3A

One thing we quickly discovered when mapping the metatexture onto the terrain world was that it didn’t work if a player chose to run in the game’s vertex lighting only mode. That mode compresses shaders into a single pass. Usually, the engine makes a reasonable choice for which pass is mapped, but with the metashaders, that wasn’t the case. The solution: allow the mapper to choose a substitute texture that only is used in the game’s vertex lighting mode.

For each shader that will be remapped a key/value pair must be entered in the map’s worldspawn.

Key: vertexremapshader

Value: normal_shader;vertexlighting_shader

The normal_shader is the shader normally used on the terrain. The vertexlighting_shader is the shader to be used when people run the map in Q3 in vertex lit mode. The normal_shader and the vertexlighting_shader are seperated by a semi-colon ;

As many shaders can be remapped as needed by using the key. However, if more than one shader is remapped in a map, each one must have a unique identifier … either a number or a letter after the Key word, as shown by “vertexremapshaderX”, where X is a number or any character set. Examples, vertexremapshader01, vertexremapshader02, vertexremapshaderA, vertexremapshaderB, vertexremapshadermpterra2_1, etc.

In mpterra2, the key/value pair for one of the replaced shaders looked like this:

Key: vertexremapshader1

Value: textures/terrain/mpterra2_0to1;textures/terrain/vxmpterra2

Each of the three root shaders and the two blend shaders had to replaced in this manner.

The following is a sample of the shader used to replace ALL the terrain shaders in mpterra2:

// *************************************************

// *

// * Vertex Lighting Replacement Shaders

// *

// *************************************************

textures/terrain/vxmpterra2

{

surfaceparm nolightmap

q3map_novertexshadows

q3map_forcesunlight

{

map textures/stone/pjrock10b_2.tga

rgbGen vertex

tcmod scale 0.125 0.125

}

}

GridSize

The Light Grid Size (as noted earlier) is the map that the Q3A engine uses to light entities. It’s what gives the illusion of players moving in and out of shadowed areas on the game levels. We decided, that for large terrain maps, it should not be as detailed (and therefore nowhere near as large) as we had done for smaller, interior maps. After experimenting with placing controls for the grid size on the bsp command line, we finally settled on putting the command information in the map’s world spawn. In that way, the grid size could be easily tailored to the individual map.

Key/value pair:

Key: gridsize

Value: X Y Z

Note that the values are the dimensions of those coordinates. It’s best to keep them to power of 2 values. The default value for the gridsize (if left unchanged) is 64 64 128. Setting higher x y and z values reduces the size of the light grid data in both the .bsp file and in the Q3A game, but it also creates less accurate dynamic model lighting.

Errors

Definitely set the x y and z values higher if you get:

************ ERROR ************

MAX_MAP_LIGHTGRID

when compiling your map with q3map.

Back - Table of Contents - Adding Buildings

 

 

 

-23-