Nuclide
Software Development Kit for id Technology
Material Command List

Here is a list of all the commands that can be contained within a material definition file, like a mat or a shader file.

There are three different kinds of commands:

  • Surface Specific
  • Stage/Layer Specific
  • vmap Specific

Surface specific commands affect the entire surface, or sometimes whole brush-volume it belongs to. Example commands may be surfaceparm.

Stage/Layer specific commands only affect one part of the rendering stage. Generally anything within a sub-block of braces ({ }) is a stage. It defines a layer to draw on top of the surface.

Due to how simple most surfaces are, you don't have to define a stage. It is often enough to set program, diffuseMap and you're rendering a surface handled entirely by the GPU.

Some operations, such as deformVertexes or tcMod are done on the CPU. While you can use those, know that moving that action into a Shader Program is recommended.

alphafunc

Syntax

alphaFunc <func>

Overview

Determines the alpha test function used when rendering this surface.

Valid values are GT0, LT128, and GE128. These correspond to GREATER THAN 0, LESS THAN 128, and GREATER THAN OR EQUAL TO 128.

This function is used when determining if a pixel should be written to the frame-buffer. For example, if GT0 is specified, the only the portions of the texture map with corresponding alpha values greater than zero will be written to the framebuffer. By default alpha testing is disabled.

Both alpha testing and normal alpha blending can be used to get textures that have see-through parts. The difference is that alphaFunc is an all-or-nothing test, while blending smoothly blends between opaque and translucent at pixel edges.

Alpha test can also be used with depthWrite, allowing other effects to be conditionally layered on top of just the opaque pixels by setting depthFunc to equal.

alphagen

Syntax

alphaGen <func>

Overview

The alpha channel can be specified like the rgb channels. If not specified, it defaults to 1.0.

Functions

portal

This rendering stage keyword is used in conjunction with the surfaceparm keyword portal. The function accomplishes the "fade" that causes the scene in the portal to fade from view. Specifically, it means "Generate alpha values based on the distance from the viewer to the portal."

Use alphaGen portal on the last rendering pass.

blendFunc

from zanir.wz.cz/?p=60

Syntax

blendFunc <simplefunc>

blendFunc <srcBlend> <destBlend>

Overview

Blend functions are the keyword commands that tell the renderer how graphic layers are to be mixed together.

Usage

Simplified blend functions

The most common blend functions are set up here as simple commands, and should be used unless you really know what you are doing.

add

This is a shorthand command for blendFunc GL_ONE GL_ONE. Effects like fire and energy are additive.

filter

This is a shorthand command that can be substituted for either blendFunc GL_DST_COLOR GL_ZERO or blendFunc GL_ZERO GL_SRC_COLOR. A filter will always result in darker pixels than what is behind it, but it can also remove color selectively. Lightmaps are filters.

blend

Shorthand for blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA. This is conventional transparency, where part of the background is mixed with part of the texture.

Explicit blend functions

Getting a handle on this concept is absolutely key to understanding all shader manipulation of graphics.

BlendFunc or "Blend Function" is the equation at the core of processing shader graphics. The formula reads as follows:

[Source * <srcBlend>] + [Destination * <dstBlend>]

Source is usually the RGB color data in a texture file.

Destination is the color data currently existing in the frame buffer.

Rather than think of the entire texture as a whole, it maybe easier to think of the number values that correspond to a single pixel, because that is essentially what the computer is processing: One pixel of the bitmap at a time.

The process for calculating the final look of a texture in place in the game world begins with the pre-calculated lightmap for the area where the texture will be located. This data is in the frame buffer. That is to say, it is the initial data in the Destination. In an unmanipulated texture (i.e. one without a special shader script), color information from the texture is combined with the lightmap. In a shader-modified texture, the $lightmap stage must be present for the lightmap to be included in the calculation of the final texture appearance.

Each pass or "stage" of blending is combined (in a cumulative manner) with the color data passed onto it by the previous stage. How that data combines together depends on the values chosen for the Source Blends and Destination Blends at each stage. Remember it's numbers that are being mathematically combined together that are ultimately interpreted as colors.

A general rule is that any Source Blend other than GL_ONE (or GL_SRC_ALPHA where the alpha channel is entirely white) will cause the Source to become darker.

Source Blend

The following values are valid for the Source Blend part of the equation.

  • GL_ONE This is the value 1. When multiplied by the Source, the value stays the same the value of the color information does not change.
  • GL_ZERO This is the value 0. When multiplied by the Source, all RGB data in the Source becomes Zero (essentially black).
  • GL_DST_COLOR This is the value of color data currently in the Destination (frame buffer). The value of that information depends on the information supplied by previous stages.
  • GL_ONE_MINUS_DST_COLOR This is nearly the same as GL_DST_COLOR except that the value for each component color is inverted by subtracting it from one. (,i.e. R = 1.0 - DST.R, G = 1.0 - DST.G, B = 1.0 - DST.B, etc.)
  • GL_SRC_ALPHA The TGA file being used for the Source data must have an alpha channel in addition to its RGB channels (for a total of four channels). The alpha channel is an 8-bit black and white only channel. An entirely white alpha channel will not darken the Source.
  • GL_ONE_MINUS_SRC_ALPHA This is the same as GL_SRC_ALPHA except that the value in the alpha channel is inverted by subtracting it from one.(i.e. A=1.0 - SRC.A)
Destination Blend

The following values are valid for the Destination Blend part of the equation.

  • GL_ONE This is the value 1. When multiplied by the Destination, the value stays the same the value of the color information does not change.
  • GL_ZERO This is the value 0. When multiplied by the Destination, all RGB data in the Destination becomes Zero (essentially black).
  • GL_SRC_COLOR This is the value of color data currently in the Source (which is the texture being manipulated here).
  • GL_ONE_MINUS_SRC_COLOR This is the value of color data currently in Source, but subtracted from one(i.e. inverted).
  • GL_SRC_ALPHA The TGA file being used for the Source data must have an alpha channel in addition to its RGB channels (four a total of four channels). The alpha channel is an 8-bit black and white only channel. An entirely white alpha channel will not darken the Source.
  • GL_ONE_MINUS_SRC_ALPHA This is the same as GL_SRC_ALPHA except that the value in the alpha channel is inverted by subtracting it from one. (i.e. A=1.0 - SRC.A).
Doing the Math: The Final Result

The product of the Source side of the equation is added to the product of the Destination side of the equation. The sum is then placed into the frame buffer to become the Destination information for the next stage. Ultimately, the equation creates a modified color value that is used by other functions to define what happens in the texture when it is displayed in the game world.

Default Blend Function

If no blendFunc is specified then no blending will take place. That's just a fact of life.

depthFunc

Syntax

depthFunc <func>

Overview

This controls the depth comparison function used while rendering.

The default is lequal (Less than or equal to) where any surface that is at the same depth or closer of an existing surface is drawn. This is used for textures with transparency or translucency. Under some circumstances you may wish to use equal, e.g. for light-mapped grates that are alpha tested (it is also used for mirrors).

depthWrite

Syntax

depthWrite

Overview

By default, writes to the depth buffer when depthFunc passes will happen for opaque surfaces and not for translucent surfaces.

Blended surfaces can have the depth writes forced with this function.

program

program defines which GLSL/HLSL shader to load for a defined material. It also accepts arguments that will recompile a shader with certain permutations. This is kinda ugly,

Starting in The Wastes 1.2, there are the following shader programs available to you:

  • program unlit
  • program lightmapped
  • program vertexlit
  • program water
  • program refract

rgbGen

Syntax

rgbGen <func>

rgbGen wave <func> <base> <amp><phase> <freq>

Overview

Defines what vertex colors are set to for any given surface.

If no rgbGen is specified, either "identityLighting" or"identity" will be selected, depending on which blend modes are used.

Valid <func> parameters are const, wave, identity, identityLighting, entity, oneMinusEntity, fromVertex, and lightingDiffuse.

Functions

const

Follow this up with a vector of the color that you'd like the vertex colors to be set as. An example for green would be:

rgbGen const 0.0 1.0 0.0

identityLighting

Colors will be (1.0,1.0,1.0) if running without overbright bits (NT, linux, windowed modes), or (0.5, 0.5, 0.5) if running with overbright. Overbright allows a greater color range at the expense of a loss of precision. Additive and blended stages will get this by default.

identity

Colors are assumed to be all white (1.0,1.0,1.0). All filters stages (lightmaps, etc) will get this by default.

entity

Colors are grabbed from the entity's .colormod field.

oneMinusEntity

Colors are grabbed from 1.0 minus the entity's .colormod field.

entityLighting

Introduced by FTE, same as entity, but will receive lighting similar to identityLighting on top of it.

vertex

Colors are filled in directly by the data from the map or model files. This is used for blending brushes and patches. It was used at one point to store primitive lighting, in case the lightmapped rendering path was to expensive (this is no longer available).

oneMinusVertex

As rgbGen vertex, but inverted.

Design Note: This keyword would probably not be used by a level designer

lightingDiffuse

Colors are computed using a standard diffuse lighting equation. It uses the vertex normals to illuminate the object correctly.

Design Note: -rgbGen lightingDiffuse is used when you want the RGB values to be computed for a dynamic model (i.e. non-map object) in the world using regular in-game lighting. For example, you would specify on materials for items, characters, weapons, etc.

wave <func> <base> <amp><phase> <freq>

Colors are generated using the specified waveform. An affected texture with become darker and lighter, but will not change hue. Hue stays constant. Note that the rgb values for color will not go below 0 (black) or above 1 (white). Valid waveforms are sin, triangle, square, sawtooth and inversesawtooth.

  • Sin: color flows smoothly through changes.
  • Triangle: color changes at a constant rate and spends no appreciable time at peaks and valleys.
  • Square: color alternates instantly between its peak and valley values.
  • Sawtooth: With a positive frequency value, the color changes at a constant rate to the peak then instantly drops to its valley value.
  • Inversesawtooth: An inverse sawtooth wave will reverse this, making the ascent immediate (like a square wave) and the decay fall off like a triangle wave.

Baseline value. The initial RGB formula of a color (normalized).

Amplitude. This is the degree of change from the baseline value. In some cases you will want values outside the 0.0 to 1.0 range, but it will induce clamping (holding at the maximum or minimum value for a time period) instead of continuous change.

See the explanation for phase under the waveforms heading of Key Concepts.

Frequency. This is a value (NOT normalized) that indicates peaks per second.

tcGen

Syntax

tcGen <coordinate source>

Overview

Specifies how texture coordinates are generated and where they come from. Valid functions are base, lightmap and environment.

Sources

base

Base texture coordinates from the original art.

lightmap

Lightmap texture coordinates.

environment

Make this object environment mapped.

tcMod

Syntax

tcMod <func> [...]

Overview

Specifies how texture coordinates are modified after they are generated.

The valid functions for tcMod are rotate, scale, scroll, stretch and transform.

Transform is a function generally reserved for use by programmers who suggest that designers leave it alone.

When using multiple tcMod functions during a stage, place the scroll command last in order, because it performs a mod operation to save precision, and that can disturb other operations.

Texture coordinates are modified in the order in which tcMods are specified. In otherwords, if you see:

 tcMod scale 0.5 0.5
 tcMod scroll 1 1

Then the texture coordinates will be scaled then scrolled.

Functions

rotate <degrees per per second>

This keyword causes the texture coordinates to rotate. The value is expressed in degrees rotated each second. A positive value means clockwise rotation. A negative value means counterclockwise rotation. For example "tcMod rotate 5" would rotate texture coordinates 5 degrees each second in a clockwise direction. The texture rotates around the center point of the texture map, so you are rotating a texture with a single repetition, be careful to center it on the brush (unless off-center rotation is desired).

scale <sScale> <tScale>

Resizes (enlarges or shrinks) the texture coordinates by multiplying them against the given factors of <sScale> and <tScale). The values "s" and "t" conform to the "x" and "y" values (respectively) as they are found in the original texture. The values for sScale and tScale are NOT normalized. This means that a value greater than 1.0 will increase the size of the texture. A positive value less than one will reduce the texture to a fraction of its size and cause it to repeat within the same area as the original texture (Note: see [clampmap](clampmap) for ways to control this).

Example: tcMod scale 0.5 2 would cause the texture to repeat twice along its width, but expand to twice its height (in which case half of the texture would be seen in the same area as the original)

scroll <sSpeed> <tSpeed>

Scrolls the texture coordinates with the given speeds. The values "s" and "t" conform to the "x" and "y" values (respectively) as they are found in the original texture. The scroll speed is measured in "textures" per second. A "texture" is the dimension of the texture being modified and includes any previous material modifications to the original texture). A negative s value would scroll the texture to the left. A negative t value would scroll the texture down.

Example: tcMod scroll 0.5 -0.5 moves the texture down and right (relative to the texture's original coordinates) at the rate of a half texture each second of travel.

This should be the LAST tcMod in a stage. Otherwise there maybe popping or snapping visual effects in some materials.

stretch <func> <base> <amplitude> <phase> <frequency>

Stretches the texture coordinates with the given function. Stretching is defined as stretching the texture coordinate away from the center of the polygon and then compressing it towards the center of the polygon.

base: A base value of one is the original dimension of the texture when it reaches the stretch stage. Inserting other '''values positive or negative in this variable will produce unknown effects.

amplitude: This is the measurement of distance the texture will stretch from the base size. It is measured, like scroll, in textures. A value of 1 here will double the size of the texture at its peak.

phase: See the explanation for phase under the deform vertexes keyword.

frequency: this is wave peaks per second.

func:

  • Sin: the texture expands smoothly to its peak dimension and then shrinks smoothly to its valley dimension in a flowing manner.
  • Triangle: The textures stretch at a constant rate and spend no appreciable time at the peak or valley points.
  • Square: The texture is shown at its peak for the duration of the frequency and then at its valley for the duration of the frequency.
  • Sawtooth: the texture stretches like a triangle wave until it reaches a peak, then instantly drops to the valley, as in a square wave.
  • Inversesawtooth: this is the reverse of the sawtooth wave.

transform <m00> <m01> <m10> <m11> <t0> <t1>

Transforms each texture coordinate as follows:

S' = s * m00 + t * m10 + t0 T' = s * m01 + t * m11 + t1

This is for use by programmers.

turb <base> <amplitude> <phase> <freq>

Applies turbulence to the texture coordinate. Turbulence is a back and forth churning and swirling effect on the texture.

The parameters for this are defined as follows:

  • base: Currently undefined.
  • amplitude: This is essentially the intensity of the disturbance or twisting and squiggling of the texture.
  • phase: See the explanation for phase under the [deformvertexes](DeformVertexes) keyword.
  • freq: Frequency. This value is expressed as repetitions or cycles of the wave per second. A value of one would cycle once per second. A value of 10 would cycle 10 times per second. A value of 0.1 would cycle once every 10 seconds.

bemode

Syntax

bemode <mode>

Overview

Filters which back end rendering features are drawn on top of the material. While you're not encouraged to be overriding this value, it is sometimes necessary.

Modes

These are the different modes that we can specify.

rtlight

All light types will be drawn onto this surface.

rtlight_only

Dynamic lights only.

rtlight_smap

Shadowmaps only.

rtlight_spot

Spotlights only.

rtlight_cube

Cubemap lights only.

rtlight_cube_smap

Cubemap lights and shadowmaps only.

rtlight_cube_spot

Cubemap lights and spotlights only.

rtlight_spot_smap

Spot lights and shadowmaps only.

rtlight_cube_spot_smap

Cubemap lights, spot lights and shadowmaps only.

crepuscular

For skies that might cast rays.

Those are rendered to a frame buffer object (with everything else being depthdark) and is then applied to the screen as a post-processing effect.

depthonly

Used mainly by shadow maps.

depthdark

Black depth passes only. Used to draw a black world, when r_shadow_realtime_world_lightmaps is 0 for example.

gbuffer

prelight

Deferred lighting only.

fog

Fog layer only.

cull

Syntax

cull <side>

Overview

Every surface of a polygon has two sides, a front and a back. Typically, we only see the front or "out" side. For example, a solid block you only show the front side. In many applications we see both. For example, in water, you can see both front and a back. The same is true for things like grates and screens.

To "cull" means to remove. The value parameter determines the type of face culling to apply. The default value is cull front if this keyword is not specified. However for items that should be inverted then the value back should be used. To disable culling, the value disable or none should be used. Only one cull instruction can be set for the material.

Sides

front

This is the default value. The front or "outside" of the polygon is not drawn in the world. It is used if the keyword "cull " appears in the content instructions without a <side> value or if the keyword cull does not appear at all in the shader.

back

Cull back removes the back or "inside" of a polygon from being drawn in the world.

none

Neither side of the polygon is removed. Both sides are drawn in the game. Very useful for making panels or barriers that have no depth, such as grates, screens, metal wire fences and so on and for liquid volumes that the player can see from within. Also used for energy fields, sprites, and weapon effects (e.g. plasma).

Design Notes: For things like grates and screens, put the texture with the cull none property on one face only. On the other faces, use a non-drawing texture.

deformVertexes

Syntax

deformVertexes <func>

Overview

This command performs a general deformation on the surface's vertexes, changing the actual shape of the surface before drawing the shader passes. You can stack multiple deformVertexes commands to modify positions in more complex ways, making an object move in two dimensions, for instance.

Functions

wave <siv> <func> <base> <amplitude> <phase> <freq>

Designed for water surfaces, modifying the values differently at each point.

It accepts the standard wave functions of the type: sin, triangle, square, sawtooth or inversesawtooth.

The "div" parameter is used to control the wave "spread" - a value equal to the tessSize of the surface is a good default value.

normal <siv> <func> <base> <amplitude> <frequency>

This deformation affects the normals of a vertex without actually moving it, which will effect later material options like lighting and especially environment mapping. If the material stages don't use normals in any of their calculations, there will be no visible effect.

Design Notes: Putting values of 0.1 to 0.5 in Amplitude and 1.0 to 4.0 in the Frequency can produce some satisfying results. Some things that have been done with it: A small fluttering bat, falling leaves, rain, flags.

bulge <bulgeWidth> <bulgeHeight> <bulgeSpeed>

This forces a bulge to move along the given s and t directions. Designed for use on curved pipes.

move <x> <y> <z> <func> <base> <amplitude> <phase> <freq>

This keyword is used to make a brush, curve patch or model appear to move together as a unit. The x y and z values are the distance and direction in game units the object appears to move relative to it's point of origin in the map.

The func base amplitude phase and freq values are the same as found in other wave form manipulations.

The product of the function modifies the values x, y, and z.Therefore, if you have an amplitude of 5 and an x value of 2, the object will travel 10 units from its point of origin along the x axis. This results in a total of 20 units of motion along the x axis, since the amplitude is the variation both above and below the base.

It must be noted that an object made with this material does not actually change position, it only appears to.

Design Note: If an object is made up of surfaces with different materials, all must have matching deformVertexes move values or the object will appear to tear itself apart!

autosprite

This function can be used to make any given triangle quad (pair of triangles that form a square rectangle) automatically behave like a sprite without having to make it a separate entity.

This means that the "sprite" on which the texture is placed will rotate to always appear at right angles to the player's view as a sprite would. Any four-sided brush side, flat patch, or pair of triangles in a model can have the autosprite effect on it. The brush face containing a texture with this material keyword must be square.

Design Note: This is best used on objects that would appear the same regardless of viewing angle. An example might be a glowing light flare.

autosprite2

Is a slightly modified "sprite" that only rotates around the middle of its longest axis.

This allows you to make a pillar of fire that you can walk around, or an energy beam stretched across the room.

Notes

Specific parameter definitions for deform keywords:

<siv>

This is roughly defined as the size of the waves that occur. It is measured in game units. Smaller values create agreater density of smaller wave forms occurring in a given area. Larger values create a lesser density of waves, or otherwise put, the appearance of larger waves. To look correct this value should closely correspond to the value (in pixels) set for tessSize of the texture. A value of 100.0 is a good default value (which means your tessSize should be close to that for things tolook "wavelike").

<func>

This is the type of wave form being created. sin stands for sine wave, a regular smoothly flowing wave. triangle is a wave with a sharp ascent and a sharp decay. It will make a choppy looking wave forms. A square wave is simply on or off for the period of the frequency with no in between. The sawtooth wave has the ascent of a triangle wave, but has the decay cut off sharply like a square wave. An inversesawtooth wave reverses this.

<base>

This is the distance, in game units that the apparent surface of the texture is displaced from the actual surface of the brush as placed in the editor. A positive value appears above the brush surface. A negative value appears below the brush surface.

<amplitude>

The distance that the deformation moves away from the base value. See Wave Forms in the introduction for a description of amplitude. <phase> SeeWave Forms in the introduction for a description of phase)

<frequency>

See Wave Forms in the introduction for a description of frequency)

Design Note: The siv and amplitude parameters, when used in conjunction with liquid volumes like water should take into consideration how much the water will be moving. A large ocean area would have have massive swells (big siv values) that rose and fell dramatically (big amplitude values). While a small, quiet pool may move very little.

diffuseMap

Syntax

diffuseMap <texturepath/texturename>

Overview

Specifies the default texture asset to use on the diffuse/albedo pass of the material. This is the base texture in most cases. Some special materials used for special effects and the like might not have one. However surfaces such as floors, walls etc. certainly do. It will affect which texture is used to get color information from for lighting passes, etc.

fogParms

Syntax

fogParms <red value> <green value> <blue value> <distance to opaque>

Overview

Note: you must also specify "surfaceparm fog" to cause vmap 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. To obtain the values that define fog color 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).

Notes

  • The fog volume can only have one surface visible (from outside the fog).
  • Fog must be made of one brush. It cannot be made of adjacent brushes.
  • Fog brushes must be axial. This means that only square or rectangular brushes may contain fog, and those must have their edges drawn along the axes of the map grid (all 90 degree angles).

Design Notes:

  • If a water texture contains a fog parameter, it must be treated as if it were a fog texture when in use.
  • If a room is to be filled completely with a fog volume,it can only be entered through one surface (and still have the fog function correctly).
  • Additional shader passes may be placed on a fog brush, as with other brushes.

fte_clutter

Syntax

fte_clutter <model> <spacing> <scale min> <scale max> <z offset> <angle min> <angle max>

Overview

Similar to [vmap_surfaceModel (vmap_surfacemodel.md), however it'll place models at runtime. The density can be controlled via the cvar r_clutter_density.

fullbrightMap

Syntax

fullbrightMap <texturepath/texturename>

Overview

The texture is essentially a fullbright overlay on top of the diffuse/albedomap.

Not all Shaders support them. In some, like the unlit shader, the diffusemap is always fullbright.

noMipmaps

Syntax

noMipmaps

Overview

This implies noPicMip, but also prevents the generation of any lower resolution mipmaps for use by the 3d card. This will cause the texture to alias when it gets smaller, but there are some cases where you would rather have this than a blurry image. Sometimes thin slivers of triangles force things to very low mipmap levels, which leave a few constant pixels on otherwise scrolling special effects.

noPicMip

Syntax

noPicMip

Overview

This causes the texture to ignore user-set values for the gl_picmip cvar command. The image will always be high resolution. Example: Used to keep images and text in the heads up display from blurring when user optimizes the game graphics.

normalMap

Syntax

normalMap <texturepath/texturename>

Overview

Specifies the default texture to use for any normalmap operations. This depends heavily on which [GLSL program](Shaders) is used inside the later stages. The dynamic lights will use this to determine height information for light and shadows. So sometimes you want to skip setting this.

Creating normal maps to use with this command

Check out our [Normal mapping guide](Normal_mapping_guide).

polygonOffset

Syntax

polygonOffset

Overview

Surfaces rendered with the polygonOffset keyword are rendered slightly off the polygon's surface. This is typically used for wall markings and "decals." The distance between the offset and the polygon is variable. If no value is supplied a distance of 1 is assumed, however this is meant for backwards compatibility. Being explicit will help grepping values later in case you need to find all surfaces with just a polygonOffset of 1.

portal

Syntax

portal

Overview

Specifies that this texture is the surface for a portal or mirror. In the game map, a portal entity must be placed directly in front of the texture (within 64 game units). All this does is set "sort portal", so it isn't needed if you specify that explicitly.

reflectCube

Syntax

reflectCube <texturepath/cubemapname>

Overview

Specifies which cubemap to use on this material. By default, the engine will pass the nearest in-world cubemap instead.

reflectMask

Syntax

reflectMask <texturepath/texturename>

Overview

Defines a texture that specifies which parts of a material will reveal a reflective material, such as a cubemap. This applies to standard FTEQW. In Nuclide the reflectmask is currently unused with the included shaders. If you want to apply reflectivity to your materials, use the alpha channel of your normalmap instead.

skyParms

Overview

skyParms <farbox> <cloudheight> <nearbox>

Specifies how to use the surface as a sky, including an optional far box (stars, moon, etc), optional cloud layers with any shader attributes, and an optional near box (mountains in front of the clouds, etc). Some of the VMAP specific commands use this as a reference as to what skybox to use for color, intensity etc.

The renderer will take it into account only if you do not supply any Stages in the material.

farbox: Specifies a set of files to use as an environment box behind all cloudlayers. Specify "-" for no farbox, or a file base name. A base name of "env/test" would look for files "env/test_rt.tga", "env/test_lf.tga", "env/test_ft.tga", "env/test_bk.tga", "env/test_up.tga", "env/test_dn.tga" to use as the right / left / front / back / up / down sides.

cloudheight: controls apparent curvature of the cloud layers - lower numbers mean more curvature (and thus more distortion at the horizons). Higher height values create "flatter" skies with less horizon distortion. Think of height as the radius of a sphere on which the clouds are mapped. Good ranges are 64 to 256. The default value is 128.

nearbox: Specified as farbox, to be alpha blended ontop of the clouds. This has not be tested in a long time, so it probably doesn't actually work. Set to "-" to ignore.

Example Sky Material

   // Vera Visions Material
   {
       qer_editorImage textures/skies/dune.tga
       skyParms textures/skies/dune/bg 256 -
       noPicMip
       noMipmaps
       
       surfaceParm sky
       surfaceParm noimpact
       surfaceParm nolightmap
       surfaceParm nodlight
       {
           program skybox
           map $cube:textures/skies/dune/bg
           map textures/skies/clouds/dunecloud.tga
           map textures/skies/clouds/dunecloud_layer.tga
       }
   }

sort

Syntax

sort

Overview

Use this keyword to fine-tune the depth sorting of materials as they are compared against other materials in the game world. The basic concept is that if there is a question or a problem with materials drawing in the wrong order against each other, this allows the designer to create a hierarchy of which materials draws in what order.

The default behavior is to put all blended materials in sort "additive" and all other materials in sort "opaque", so you only need to specify this when you are trying to work around a sorting problem with multiple transparent surfaces in a scene.

Values

The value here can be either a numerical value or one of the keywords in the following list (listed in order of mostly ascending priority):

  • ripple: Meant for surfaces blending below water surfaces I guess.
  • eferredlight: Blend at the same order as deferred lighting. So before diffuse mapping usually takes place.
  • portal: This surface is a portal, it draws over every other shader seen inside the portal, but before anything in the main view.
  • sky: Typically, the sky is the farthest surface in the game world. Drawing this after other opaque surfaces can be an optimization on some cards. This currently has the wrong value for this purpose, so it doesn't do much of anything.
  • opaque: This surface is opaque (rarely needed since this is the default with noblendfunc)
  • decal: Blend it like a decal. Ones affected by light, or something.
  • seethrough: Not sure what to call this, beyond repeating its name and it being between decal and unlitdecal.
  • unlitdecal: Blend it like an unlit decal, this most commonly is bullet impacts.
  • banner: Transparent, but very close to walls.
  • underwater: Draw behind normal transparent surfaces.
  • blend: Draw like a blendFunc blend transparent surface.
  • additive: normal transparent surface (default for shaders with blendfuncs)
  • nearest: this shader should always sort closest to the viewer, e.g. muzzle flashes and blend blobs

It is generally recommended you stick to the keywords. The engine may introduce new ones and you will benefit from internal sorting parameters not clashing with yours whenever the engine may update them.

specularMap

Syntax

specularMap <texturepath/texturename>

Overview

Can set the specularity of the surface in relation to dlights. Specularity is the intensity of the light reflecting off the surface. In special cases some [GLSL programs](Shaders) might use the texture it for other purposes, too.

surfaceparm

Overview

The surfaceparm keyword is not only read by the VMAP compiler, but also by the renderer. A few keywords will only apply to any one of them.

All surfaceparm keywords are preceded by the word surfaceparm as follows:

surfaceparm **fog**

Behaviour Keywords

Commands that affect core functionality of a surface, or could impact the entire room or the gameplay surrounding it.

areaportal

A brush marked with this keyword functions as an area portal, a break in the VMAP tree. It is typically placed on a very thin brush placed inside a door entity (but is not a part of that entity). The intent is to block the game from processing surface triangles located behind it when the door is closed. It is also used by the BSPC (bot area file creation compiler) in the same manner as a clusterportal. The brush must touch all the structural brushes surrounding the areaportal.

clusterportal

A brush marked with this keyword function creates a subdivision of the area file (.aas) used by the bots for navigation. It is typically placed in locations that are natural breaks in a map, such a sentrances to halls, doors, tunnels, etc. The intent is keep the bot from having to process the entire map at once. As with the the areaportal parameter, the affected brush must touch all the structural brushes surrounding the areaportal.

donotenter

Read as "do not enter." Like clusterportal, this is a bot-only property. A brush marked with donotenter will not affect non-bot players, but bots will not enter it. It should be used only when bots appear to have difficulty navigating around some map features.

lava

Assigns to the texture the game properties set for lava. This affects both the surface and the content of a brush.

nodamage

The player takes no damage if he falls onto a texture with this surfaceparm

nosteps

The player makes no sound when walking on this texture.

nonsolid

This attribute indicates a brush, which does not block the movement of entities in the game world. It applied to triggers, hint brushes and similar brushes. This affects the content of a brush.

origin

Used on the "origin" texture. Rotating entities need to contain an origin brush in their construction. The brush must be rectangular (or square). The origin point is the exact center of the origin brush.

playerclip

Blocks player movement through a nonsolid texture. Other game world entities can pass through a brush marked playerclip. The intended use for this is to block the player but not block projectiles like rockets.

slick

This surfaceparm included in a texture should give it significantly reduced friction.

slime

Assigns to the texture the game properties for slime. This affects both the surface and the content of a brush.

structural

This surface attribute causes a brush to be seen by the VMAP process as a possible break-point in a BSP tree. It is used as a part of the material for the "hint" texture. Generally speaking, any opaque texture not marked as "detail" is, by default, structural, so you shouldn't need to specify this.

water

Assigns to the texture the game properties for water.

climb

Marks the desired surface as a climbable surface. This currently affects the entire volume.

vehicleclip

Blocks all movement of vehicle entities through this surface.

leakssteam

When this surface is impacted, steam will leak out temporarily. Specific to The Wastes 1.3.

leakswater

When this surface is impacted, water will leak out temporarily. Specific to The Wastes 1.3.

fl_r1

Reserved for custom games. This can be anything.

fl_r2

Reserved for custom games. This can be anything.

fl_r3

Reserved for custom games. This can be anything.

fl_r4

Reserved for custom games. This can be anything.

fl_r5

Reserved for custom games. This can be anything.

fl_r6

Reserved for custom games. This can be anything.

fl_r7

Reserved for custom games. This can be anything.

Rendering Keywords

Commands that affect rendering of a surface, or the how surfaces are made to look by the compiler. These do not affect gameplay function.

alphashadow

This keyword applied to a texture on a brush, patch or model will cause the lighting phase of the VMAP process to use the texture's alpha channel as a mask for casting static shadows in the game world.

Design Note: Alphashadow does not work well with fine line detail on a texture. Fine lines may not cast acceptable shadows. It appears to work best with well-defined silhouettes and wider lines within the texture. Most of our tattered banners use this to cast tattered shadows.

fog

Fog defines the brush as being a "fog" brush. This is a VMAP function that chops and identifies all geometry inside the brush. The General material keyword fogparms must also be specified to tell how to draw the fog.

lightfilter

Causes the VMAP light stage to use the texture's RGB and alpha channels to generate colored alpha shadows in the lightmap. For example, this can be used to create the colored light effect cast by stained glass windows. This can be used with surfaceparm alphashadow if an alpha is to be respected.

nodlight

Read as "No DeeLight". A texture containing this parameter will not be affected or lit by dynamic lights, such as weapon effects. The VMAP compiler doesn't really care about this, but the renderer does.

nodraw

A texture marked with nodraw will not visually appear in the game world. Most often used for triggers, clip brushes, origin brushes, and so on. Light will pass through it, therefore beware of bleeding issues when using nodraw/caulk textures with this.

nodraw2

Same as nodraw, but the engine won't draw it, whereas the VMAP compiler will react to the surface. So unlike nodraw, light will not pass through these surfaces.

noimpact

World entities will not impact on this texture. No explosions occur when projectiles strike this surface and no marks will be left on it. Sky textures are usually marked with this texture so those projectiles will not hit the sky and leave marks.

nomarks

Projectiles will explode upon contact with this surface, but will not leave marks. Blood will also not mark this surface. This is useful to keep lights from being temporarily obscured by battle damage.

Blob shadows (aka r_shadows 1) also counts as a mark. So any surface that you don't want to see affected by shadows should receive this surfaceparm.

nolightmap

This texture does not have a lightmap phase. It is not affected by the ambient lighting of the world around it. It does not require the addition of an rgbGen identity keyword in that stage.

trans

Light will pass through this surface, but only if either alphashadow or lightfilter are applied. Tells VMAP that pre-computed visibility should not be blocked by this surface. Generally, any materials that have blendfuncs should be marked as surfaceparm trans.

Material Related Keywords

Specifies which impact effects and footstep sounds are played when interacting with a given surface. Only one of them can be given at once:

alien

Defines that the surface is of an 'alien' material. Affects impact sound and effects.

flesh

Defines that the surface is of flesh. Affects impact sound and effects.

foliage

Defines that the surface is foliage. Affects impact sound and effects.

computer

Defines that the surface is of computer parts. Affects impact sound and effects.

dirt

Defines that the surface is of dirt. Affects impact sound and effects.

vent

Defines that the surface is a vent. Affects impact sound and effects.

grate

Defines that the surface is a grate. Affects impact sound and effects.

metal

Defines that the surface is of metal. Affects impact sound and effects.

glass

Defines that the surface is of glass. Affects impact sound and effects.

sand

Defines that the surface is of sand. Affects impact sound and effects.

slosh

Defines that the surface is of a liquid. Affects impact sound and effects.

snow

Defines that the surface is of snow. Affects impact sound and effects.

tile

Defines that the surface is of kitchen/bathroom tiles. Affects impact sound and effects.

wood

Defines that the surface is of wood. Affects impact sound and effects.

concrete

Defines that the surface is of concrete. Affects impact sound and effects.

vmap_backmaterial

Syntax

vmap_backMaterial <material>

Overview

This allows a brush surface to use a different material when you are inside it looking out.

By way of example, this would allow a water brush (or other) surfaces to have a different sort order or appearance when seen from the inside.

vmap_backMaterial only works on brush faces. For this reason, it is often deprecated in favor of using [vmap_cloneMaterial](vmap_cloneMaterial) where the target material contains [vmap_invert](vmap_invert).

It can still be useful as a kind of shorthand.

vmap_backsplash

Syntax

vmap_backsplash <percent> <distance>

Overview

Controls the percentage of [surface light](vmap_surfaceLight) backsplash (how much light the emitting surface hits), as well as the distant away from the surface of which it is cast. This is really tricky to get right in tight areas, so put time aside to experiment.

The default backsplash amount is 5%, and the default distance is about 16 units.

vmap_basematerial

Syntax

vmap_baseMaterial <material>

Overview

Copies the vmap_/surfaceparm commands from the specified material into this one.

However, if you want to copy the appearance and only specify compiler-specific modifications, use [vmap_remapMaterial](vmap_remapMaterial).

vmap_bounce

Syntax

vmap_bounce <scale>

Overview

Specifies the fraction of light to re-emit during a bounce pass on this surface.

vmap_clonematerial

Syntax

vmap_cloneMaterial <material>

Overview

A material with this directive will inherit the target material's properties and appearance. Be careful, this can lead to an infinite loop if a cloning material references another cloning material or itself.

vmap_invert

Syntax

vmap_invert

Overview

Inverts a surface normal. Works on brush faces, models and patches. Used in celshading to achieve the inverted backfacing hull.

Can be used with a material that is targeted by [vmap_cloneMaterial](vmap_cloneMaterial) for something similar to [vmap_backMaterial](vmap_backMaterial).

vmap_lightimage

Syntax

vmap_lightImage <texturepath>

Overview

By default, surface lights use the average color of the source image to generate the color of the light. vmap_lightImage specifies an alternate image to be used for light color emission, radiosity color emission, light filtering and alpha shadows. You can even use a light image with a different alpha channel for blurrier alpha shadows. The light color is averaged from the referenced texture. The texture must be the same size as the base image map. vmap_lightImage should appear before qer_editorImage.

vmap_lightmapfilterradius

Syntax

vmap_lightmapFilterRadius <lightmap filter radius> <light filter radius>

Overview

This is usually used on [light emitting materials](vmap_surfaceLight) to approximate finer subdivided lighting. It adds a gaussian blur effect to the lightmaps of either the material itself, or the surfaces affected by the material, or both. The values for **<lightmap filter radius>** and **<light filter radius>** are measured in world units of filtering (blurring) of lightmap data cast by any light sources.

**<lightmap filter radius>** Amount of blur set for the material itself to approximate for the [surface light's](vmap_surfaceLight) finer subdivided lighting. It should be set to 0 for sky materials since they don't have lightmaps.

**<light filter radius>**: Amount of blur set for other surfaces affected by this material's emitted light. It should be set just high enough to eliminate the "stadium shadow" effect sometimes produced by [light_environment](light_environment) or to smooth out the lighting on [surface lights](vmap_surfaceLight).

[vmap_lightmapFilterRadius](vmap_lightmapFilterRadius) should be placed before any light related material directives that you want it to affect.

vmap_lightmapmergable

Syntax

vmap_lightmapMergable

Overview

When specified, the compiler will attempt to merge all surfaces using this material together onto lightmap sheets. This can drastically reduce the artifacts occuring on surfaces like terrain where precision issues might get you black spots along the lightmap seams. Definitely use this across large collections of surfaces on which you expect smooth transitions.

vmap_lightmapsampleoffset

Syntax

vmap_lightmapSampleOffset <float>

Overview

Takes a single parameter, defaulting to 1.0, which specifies how many units off a surface should the compiler sample lighting from. Use larger values (2.0-8.0) if you're getting ugly splotches on lightmapped terrain. Try to use filtering to solve splotches if possible, leaving vmap_lightmapSampleOffset as a last resort.

vmap_lightmapsamplesize

Syntax

vmap_lightmapSampleSize <int>

Overview

Surfaces using a material with this option will have the pixel size of the lightmaps set to N world grid units. This option can be used to produce high-resolution shadows on certain surfaces. In addition, it can be used to reduce the size of lightmap data, where high-resolution shadows are not required, gaining memory and performance benefits. The default sample size is 8, smaller numbers increases lightmap resolution. In general, you should stick with power of 2 values.

vmap_lightrgb

Syntax

vmap_lightRGB <red color> <green color> <blue color>

Overview

Alternative to [vmap_lightImage (Material Command)](vmap_lightImage) and the automatic way of figuring out which light color a specified surface emits.

vmap_lightsubdivide

Syntax

q3map_lightSubdivide <units>

Overview

Used on surface lights (see [vmap_surfaceLight (Material Command)](vmap_surfaceLight)). Controls the distance between surface generated light sources for uniform lighting. It defaults to 120 game units, but can be made larger or smaller as needed (for light surfaces at the bottom of cracks, for example). This can be a dominant factor in processing time for lightmap generation.

vmap_nodirty

Syntax

vmap_nodirty

Overview

This surface is not affected by dirt-mapping. The compiler baked variant of ambient occlusion.

vmap_offset

Syntax

vmap_offset <float>

Overview

Offsets a surface along the vertex normals by N.N units. Used in celshading for those black edges. This is the sort-of the compiler version of [polygonOffset](polygonOffset)

vmap_remapmaterial

Syntax

vmap_remapMaterial <material>

Overview

Allows the material to later become known as the specified material.

These materials should not contain anything but compiler-specific keywords.

For example, if you want a material that is **exactly like'' the specified**vmap_remapMaterial**in appearance, but with a specific**vmap_''' or surfaceparm characteristics, use this command.

However, if you want want just a material's vmap_/surfaceparm properties, use [vmap_baseMaterial](vmap_baseMaterial).

vmap_shadeangle

Syntax

vmap_shadeAngle <degrees>

Overview

In short: At which angle the phong shading on a material breaks. If you set it to 0, basically no phong shading will ever be performed. The default shade angle in [VMAP](VMAP) is 40 degrees.

vmap_surfacelight

Syntax

vmap_surfacelight <intensity>

Overview

The texture gives off light equal to the value set for it. The relative surface area of the texture in the world affects the actual amount of light that appears to be radiated.

To give off what appears to be the same amount of light, a smaller texture must be significantly brighter than a larger texture.

Unless the [vmap_lightImage](vmap_lightImage) or [vmap_lightRGB](vmap_lightRGB) directive is used to select a different source for the texture's light color information, the color of the light will be the averaged color of the texture.

If you want to change the distance/range of the surfacelight, use [vmap_surfacelightDistance](vmap_surfaceLightDistance).

vmap_surfacelightdistance

Syntax

vmap_surfaceLightDistance <scale>

Overview

Increases the range of a surfacelight. This is different from increasing the [vmap_surfaceLight (Material Command)](vmap_surfaceLight) value, as it'll travel much wider without affecting the total intensity of the light.

vmap_surfacemodel

Syntax

vmap_surfaceModel <modelpath> <density> <odds> <minscale> <maxscale> <minangle> <maxangle> <oriented>

Overview

A surface with vmap_surfaceModel in its shader will randomly place a specified model across it's face. This is designed to place grass or tree models over terrain.

This will bake the models into the .bsp itself, creating an unnecessarily inflated map. Use [fte_clutter (Material Command)](fte_clutter) instead.

vmap_tesssize

Syntax

vmap_tessSize <amount>

Overview

Formely known as just tessSize.

The command controls the tessellation size (how finely a surface is chopped up in to triangles), in game units, of the surface.

This is only applicable to solid brushes, not curves, and is generally only used on surfaces that are flagged with the [deformVertexes](deformVertexes) keyword.

Abuse of this can create a huge number of triangles. This happens during BSP processing, so maps must be reprocessed for changes to take effect.

Note

It can also be used on tesselating surfaces to make sure that tesselations are large, and thus, less costly in terms of triangles created.

vmap Commands

The following commands are alter specific behaviour during the BSP compilation process. These are not respected by the engine, the renderer or the game-logic.

These assume you use vmap. If not, read the documentation for the tool that you use. This info may not always be useful for other compilers.