Shaders give the mapper control over special graphics effects that require multiple redrawing passes before they are finally displayed on the game screen. Every shader that changes the visual component of a texture uses these "Multitexture" effects. Multitexture is ON by default in Quake III Arena. It is turned off with the cvar, "set r_ext_multitexture 0 (entered in the console or bound to a key) - see the Debugging section in this document for more details.
To understand how multitexture works, you need to understand how the Quake III Arena graphic engine renders a scene. All the faces you see in Quake III Arena are made up of triangles - you can see this by using the cvar command "r_showtris 1." Initially, each triangle adds one to the "tris" number in r_speeds (the numbers that are used to estimate whether a scene is too complex). With every frame that Q3A "paints", it draws triangles onto the scene in layers, starting at the back of the scene and drawing every triangle visible until it reaches the front. It takes time to draw each triangle. If a triangle is painted with a texture that is "see through" in some way (either transluscent, transparent, or containing cut-outs), any triangles seen through that triangle must be redrawn one additional time for each stage in the the shader. If a single transparent triangle takes up the whole screen, for example, a glass window - The whole area of the screen has to be redrawn. Each triangle of glass takes an entire screen worth of "overdraw" and each extra stage on the glass adds another screenful, which is why glass can be such a big framerate hit.
The simplest form of multitexture is a Lightmap. In most cases, the Q3A engine first draws the lightmap (precalculated light and shadow information). Then, on top of that, it adds in the information from the texture art specified for that triangle using a special effect (blendfunc filter) - which blends the lightmap with the texture to make areas of the texture look light or dark. Using the cvar command "r_vertexlight 1" (Vertex Lighting instead of Lightmaps) stops Q3 from drawing the lightmap triangles (which is why many gamers use vertex lighting to gain additional playing speed).
Every extra stage in a shader is an extra triangle drawn over and blended with the first triangle in a special way. Like the lightmap example above, each additional stage requires an extra triangle to be drawn for each frame. On certain 3D accelerator cards (like the TNT - TwiN Texture), the multitexture effect cancels out the real cost of the first pass of blending. The blending for the first additional stage is done before the triangle is drawn. However, if the shader takes 3 stages (like all the shiny metal effects) it costs an extra triangle for every triangle it is used on. Every extra triangle used adds a triangle to the r_speeds triangle count. Because there are cards that don't automatically handle this first blending pass, the map maker needs to occasionally check his r_speeds with the multitexture turned off.
This brings up a pop-up dialogue box. This is one of the more complicated interfaces used during map development and may take some getting used to.
Texture
This is the path/name (beginning in Textures directory) for the
texture. You can copy from this field or paste into it. If you know
the pathname of a texture, you can enter it here. It will load
without having to first load the entire directory that contains
it.
The next five commands work on both patches and brushes. However, the results of applying a Horizontal Shift to a brush and to a patch may be substantially different. When working with patches, the numbers in the fields do not change … although the texture on the map component may be changing.
Horizontal Shift
This allows you to change the Horizontal texture offset
(position of texture on a surface). You can type an offset value
into field or use the scroll buttons on the right to shift the
texture. If "Surface Inspector Increments Match Grid" is set in Preferences, the scroll
increments will move a number of pixels equal to the grid size.
Vertical Shift This allows you to change the Vertical texture offset (position of texture on a surface). You can type an offset value into field or use the scroll buttons on the right to shift the texture. If "Surface Inspector Increments Match Grid" is set in Preferences, the scroll increments will move a number of pixels equal to the grid size.
Horizontal Stretch This allows you to change the dimensions of textures as they are mapped into the world. You can type a size value into field or use the scroll buttons on the right to enlarge or reduce the texture. The default value is 0.5. This gives a presentation in the game world of two pixels for each game unit. A Horizontal Stretch value of 1.0 would double the amount of area covered by a single repeat of the texture. Of course, doing that also reduces the apparent resolution of the texture by half (can you say blurry?)! Making the stretch value a negative number horizontally flops the texture's normals (i.e.; flops the texture left to right).
Vertical Stretch This is the same as for the Horizontal Stretch, but along the vertical axis. Making the stretch value a negative number vertically flops the texture's normals (i.e.; flops the texture up and down).
Rotate This rotates the texture around the center point of the brush (or patch). If the texture is not centered on the map component, the rotation will not necessarily look correct. The increment of rotation is set by the value given for the Rotation Inc field on the Preferences window. The default value is 45 (degrees), roughly 1/8 rotation around the axis.
Texturing
This next grouping of commands in the lower left corner of the window provides two separate sets of buttons. The top set deal with texturing geometry brushes. The lower set is for texturing curve patches.
Fit (Brush)
The texture is stretched to fit the dimensions of the brush. The
width and height fields to the right are the number of repetitions
to be used in the S and T dimensions (S corresponds to X on
the actual texture and T corresponds to Y on the actual texture).
The default value for the height and width fields is 1. You can
type a size value into field or use the scroll buttons on the right
to enlarge or reduce the texture. Only integer values can be
entered (meaning that you can't enlarge a texture 1.5 times).
CAP (Patch)
This function is most often applied to patches used to fill in
the gaps between curves and solid geometry. It can also be applied
to flat patches so that the texture doesn't appear to follow the
arc of the patch. You may need to use the SHIFT + CTRL + N command
to normalize the texture on the patch.
Set… (Patch)
This command functions almost like the "Fit" command above for
brushes. The texture will be fit across the patch based on the X
and Y values given. However, there is a notable difference. The X
and Y fields will accept non-integer values (e.g. 6.4 x 3.8). It
may take some experimentation to determine which dimension of your
patch is considered to be "X" and which is thought to be "Y". If a
value of 1x1 is given, the texture will be "fit" to the
patch.
Natural (Patch)
The engine does its best to map the texture onto the patch in a
"natural" appearing manner. This means that the texture will curve
and flow with the curves and bends in the patch. Unless you are
texturing a cap, this should be your first choice when applying a
texture.
Fit
The texture's coordinates are mapped to fit the patch
(with no repeats).
Texture replacement is global (throughout the map) unless the selected checkboxes state otherwise.
Force replacement (ignore current texture name). All textures in the map will be replaced. Best if used with Replace within selected brushes only. Be very careful with this one.
Live Updates from Texture/Camera windows. Using Live Update the user can find and replace textures with a fully point and click interface.
Texture Replacement using Live Updates
Click on the Find box, then click on any texture in either the
Camera window or the Texture window. The texture path/name for that
texture appears in the box. Next click on the Replace box and click
on the replacement texture. That texture's path/name appear in the
Replace box. Select "OK" and the replacement will occur.
Step-by-step for replacing a texture on a brush face (if live update is not used).
Texture Shift Down | (SHIFT + DOWN ARROW) |
Texture Shift Up | (SHIFT + UP ARROW) |
Texture Shift Left | (SHIFT + LEFT ARROW) |
Texture Shift Right | (SHIFT + RIGHT ARROW) |
Texture Rotate Clockwise | (SHIFT + PAGEDOWN) |
Texture Rotate Counter-Clockwise | (SHIFT + PAGEUP) |
Texture Scale Down | (CTRL + DOWN ARROW) |
Texture Scale Up | (CTRL + UP ARROW) |
Texture Scale Left | (CTRL + LEFT ARROW) |
Texture Scale Right | (CTRL + RIGHT ARROW) |
Special Content Textures Special content textures are textures where the "surface" parameters of the texture actually change the physical nature of the geometry brush and in so doing, affects the play of the game.
Water
Water is a content parameter that allows a player to "swim"
inside a geometry brush, causes a pulsing visual distortion of the
underwater geometry, and prompts the game engine to draw bubbles as
projectiles pass through it. A player can only remain under water
for a short time (without a battlesuit) and then begins to
drown.
Water usage rules:
Fog Fog content is used to block or diminish player vision and provide "atmosphere" for a level. Like water, fog can affect game performance, especially if one can see additional shader effects within it. The following information is taken from the Q3A Shader Manual regarding fog creation and usage.
fogparms <red value> <green value> <blue
value> <distance to Opaque>
This surface parameter (or "surfaceparm") defines the contents
of the fog.
Note: you must also specify "surfaceparm fog" to cause
q3map to identify the surfaces inside the volume. Fogparms
only describes how to render the fog on the surfaces.
<red value> <green value> <blue value> These are normalized values (number range from 0 to 1). A good computer art program should give you the RGB values for a color. To obtain the values that define fog color for Quake III Arena, divide the desired color's Red, Green and Blue values by 255 to obtain three normalized numbers within the 0.0 to 1.0 range.
<distance to opaque> This is the distance, in game units, until the fog becomes totally opaque, as measured from the point of view of the observer. By making the height of the fog brush shorter than the distance to opaque, the apparent density of the fog can be reduced (because it never reaches the depth at which full opacity occurs).
Fog usage rules:
Lava
Lava content, for most practical purposes, is a variation of
water content. The damage that it does to players in contact with
it is defined by game code and cannot be directly affected by the
map designer.
Slime
Slime content, for most practical purposes, is a variation of
water content. The damage that it does to players in contact with
it is defined by game code and cannot be directly affected by the
map designer.
Areaportal
Color: Opaque Red Orange
Location: (textures/common/areaportal)
The bsp tool uses areaportals to create hard, visual breaks
between areas in the map. Until triggered, the areaportal blocks
geometry behind it from being drawn or seen. The area portal brush
should be a thin (2 to 4 units thick) brush. It should touch all
the brushes that form the hull of the opening being portalled. It
must be placed inside a door. The opening of the door triggers the
portal function. The closing of the door returns it to its former
state. The areaportal texture must completely seal off a volume
from another volume (although this can be in conjunction with other
areaportals). If a door is being used to block off an area from
view, consider placing an areaportal brush inside the door. Example
in Quake III Arena: All the doors out of the central courtyard in
Q3DM12, The Dredwerkz, are areaportalled.
Caulk
Location: (common/caulk)
Color: Opaque Pink
Game Function: Caulk, the miracle texture. It blocks vis.
It seals the world off from the void. It doesn't draw (so it
doesn't add to triangle counts). It keeps curves from competing
with textures behind them. It looks like hell if you see it in your
world. From the View menu (View > Show > Caulk), you can
toggle on and off the display of caulk brush sides.
More Design Tips: Finally, and this should be used with great care, a caulk brush can be used to create an invisible support for entities. If you place a very thin caulk brush floating above a surface that would otherwise not support an entity (example: a grate made of clip brush), the brush will not draw in the world, but will support the entity. The reason for this is that SUSPENDED entities are not "seen" by bots unless they can be reached by a jump pad.
Clip
Location: (textures/common/clip)
Color: Transparent Red
Game Function: If you look at a professionally made map,
quite often you'll see that nearly every bit of wall surface is
covered in a transparent red texture called "common/clip." Clip is
a nondrawing texture that blocks player movement. Clip does not
block weapon fire. Entities, such as ammo or weapons, are not
supported by clip brushes. If placed or dropped on a clip brush,
they will pass through them.
Cluster Portal
Location: (textures/common/clip)
Color: Translucent lavender
Game Function: Works like an area portal, but for the bot
navigation file only. Cluster portal is used by the bspc utility to
subdivide the map into smaller areas for calculating bot
navigation. Appendix C: Bot Navigation Files contains the specific
details for using cluster portal texture entities.
Cushion
Location: (textures/common/clusterportal)
Color: Translucent pale aqua
Game Function: A player falling on this does not take
damage. They also don't make a "landing" sound, so use with
caution.
Do Not Enter
Location: (textures/common/donotenter)
Color: Transparent Pale Orange
Game Function: It is a tool used to solve bot navigation
problems. Use it like a clip brush, but sparingly. When you observe
bots doing stupid things in your map, try to block off the area
with this texture. The Bot Navigation Files appendix contains the
specific details for using the Do Not Enter texture entity.
Hint
Location: (textures/common/clusterportal)
Color: Transparent Yellow Green
Game Function: Helps determine the vis portals. It is
used as a suggestion to the compiler during the vis phase, when the
world is subdivided. Generally speaking, they are used to correct
vis problems, whose chief symptom is the "hall of mirrors" effect
seen during game play. These can often be corrected by careful
placement of a hint brush. If you fill the volume where the
error is seen or the volume adjacent to it, the problem may be
corrected in the next compile. This is really more art than
science.
Invisible
Location: (textures/common/noimpact)
Color:
Game Function: This was used to create a surface that
would be marked by weapon fire, but would not be drawn in the
world. This was created specifically to resolve a problem where
func_static brushes were being used to replace floor textures that
marked the location of weapons in Q3DM8. Because the rocket
launcher was located in different places between the team and the
deathmatch games, the designer wanted to make floor markers that
would not only change between game types, but would be marked like
adjacent floor pieces.
Nodrawnonsolid
Location: (textures/common/trigger)
Color: Opaque light yellow
Game Function: This is the same as nodraw.
Noimpact
Location: (textures/common/noimpact)
Color: black
Game Function: Used to create a surface which does not
block weapon fire.
Weapon fire will pass through this. This usually used as a
shader key on other textures.
Origin
Location: (textures/common/origin)
Color: Opaque Orange
Game Function: Used to create origin point in moving
b_models, such as trains, plats, and rotating objects. This
texture, applied to a square or rectangular brush, is used to
create the point of origin for moving b_models, such as trains,
plats, and rotating objects. It is used by func_trains as the point
that passes through path entities and the source for sound
attachment
Skip
Location: (textures/common/skip)
Color: Transparent yellow
Game Function: Do not use in Q3A. This texture was used
in Quake 2 maps to discard sides of hint brushes. It is
nonfunctional in Q3A.
Slick
Location: (textures/common/trigger)
Color: Translucent Pale Blue
Game Function: Not stick coating for map surfaces.
Reduces friction. Use like a very thin clip brush over surfaces you
want to be low friction.
Trigger
Location: (textures/common/trigger)
Color: Transparent Dark Yellow
Game Function: Used to make trigger brushes.
Weapon Clip
Location: (textures/common/weap_clip)
Color: Transparent Red
Game Function: This version of the clip brush only stops
weapon projectiles from passing through it. No marks are left on
the surface.
Design Tip: Use to create clip surfaces for map object
models.