Material Reference

From Mod Wiki

This is a reference of all material keywords and parameters.

Parameters Key

These are all the parameters which can be passed to material functions and values.

<float> Any number.
<int> An integer - any number without a fractional part.
<string> Any value enclosed in quotes.
<index> An integer number that is an index into an array.
<map> An image map, which may include image programs (below).
<prog> A vertex / frament program. Written using the GL ARB shader language. These files are stored in the glprogs directory.
<exp> An expression that is evaluated every frame.


Global Keywords for Regular Materials

qer_editorimage <map> Image to display in the editor
description <string> Just a simple description for people using this material
polygonOffset [float] offset the depth buffer to combat z-fighting
noShadows Don't cast shadows
noSelfShadow This material doesn't cast shadows on the model it's on (but it does on other models)
forceShadows Allows nodraw surfaces to cast shadows
noOverlays Overlay / Decal suppression
forceOverlays Force decal overlays for alpha tested or translucent surfaces
translucent The engine thinks this is a translucent material (which means no ambient/zfill pass will be done for this material)
forceOpaque Opposite forces the engine to think this is a nontranslucent material.
twoSided Draw the front and back. Implies no-shadows, because the shadow volume would be coplanar with the surface, giving depth fighting.
backSided Draw only the back. This also implies no-shadows.
mirror Use to make mirrors
noFog Don't fog this surface
guisurf <guifile>

guisurf entity[2|3]

This surface has a gui on it. Use "somegui.gui" to specify the gui, or entity, entity2, entity3, etc for the level designer to set it in Radiant.
sort <type> Type is one of: subview, opaque, decal, far, medium, close, almostNearest, nearest, postProcess
spectrum <int> Spectrums are used for "invisible writing" that can only be illuminated by a light of matching spectrum
deform <type> Type is one of: sprite, tube, flare, expand, move, turbulent, eyeBall, particle, particle2
decalInfo <staySeconds>

<fadeSeconds> [start rgb] [end rgb]

Used in decal materials to set how long the decal stays, and how it fades out.
renderbump <args...> RenderBump command options, without "renderbump" at the start
diffusemap <map> shortcut for
{  
   blend diffusemap
   map <map>
}
specularmap <map> shortcut for
{  
   blend specularmap  
   map <map>
}
bumpmap <map> shortcut for
{
   blend bumpmap
   map <map>
}
DECAL_MACRO shortcut for
polygonOffset 1
discrete
sort decal
noShadows


Global Keywords for Light Materials

noShadows This light doesn't cast shadows.
forceShadows fog, blend, and ambient lights don't cast shadows by default. This forces them to cast shadows.
noPortalFog This fog volume won't ever consider a portal fogged out.
fogLight Option to fill with fog from viewer instead of light from center.
blendLight Perform simple blending of the projection, instead of interacting with bumps and textures.
ambientLight An ambient light has non-directional bump mapping and no specular.
lightFalloffImage <map> specifies the image to use for the third axis of projected light volumes.


Global Surface Parameters

surfacetype "<stp>" Sets a surface type for particles and sound effects, where <stp> is one of the valid surface types.
solid may need to override a clearSolid
water used for water
playerclip solid to players
monsterclip solid to monsters
moveableclip solid to moveable entities
ikclip solid to IK
blood used to detect blood decals
trigger used for triggers
aassolid solid for AAS
aasobstacle used to compile an obstacle into AAS that can be enabled/disabled
flashlight_trigger used for triggers that are activated by the flashlight
nonsolid clears the solid flag
nullNormal renderbump will draw as 0x80 0x80 0x80, which won't collect light from any angle
areaportal divides areas
qer_nocarve don't cut brushes in editor
discrete surfaces should not be automatically merged together or clipped to the world, because they represent discrete objects like gui shaders mirrors, or autosprites
noFragment dmap won't cut surface at each bsp boundary
collision collision surface. if a model has no collision surfaces, then all surfaces are considered collision surfaces
noimpact don't make impact explosions or marks
nodamage no falling damage when hitting
ladder player can climb up this surface
nosteps No footstep sounds.


Stage Keywords

blend <type> blend <src>, <dst>

Blend types: Type Src Dst

blend gl_src_alpha gl_one_minus_src_alpha 
add gl_one gl_one 
filter gl_dst_color gl_zero 
modulate gl_dst_color gl_zero 
none gl_zero gl_one 
bumpmap Normal map 
diffusemap Diffuse map 
specularmap Specular map 


Source blend modes: gl_one Constant 1

gl_zero Constant 0 
gl_dst_color The color currently on the screen 
gl_one_minus_dst_color One minus the color currently on the screen 
gl_src_alpha The alpha channel of the source image 
gl_one_minus_src_alpha One minus the alpha channel of the source image 
gl_dst_alpha The alpha channel of the screen image 
gl_one_minus_dst_alpha One minus the alpha channel of the screen image 
gl_src_alpha_saturate Minimum of the source alpha and one minus screen alpha 


Destination blend modes: gl_one Constant 1

gl_zero Constant 0 
gl_src_color The color of the source image 
gl_one_minus_src_color One minus the color of the source image 
gl_src_alpha The alpha channel of the source image 
gl_one_minus_src_alpha One minus the alpha channel of the source image 
gl_dst_alpha The alpha channel of the screen image 
gl_one_minus_dst_alpha One minus the alpha channel of the screen image 


map <map> The image program to use for this stage.
remoteRenderMap <int> <int> Width and Height of the buffer to render a remote image in to (for cameras). The entity this material is applied to has to support remote render views.
mirrorRenderMap <int> <int> Width and Height of the buffer to render a mirror in to. This of course makes this stage a mirror stage, which is different from using the 'mirror' global keyword because that makes the entire material a mirror, rather than just one stage.
videomap [loop] <file> This stage uses a video stream as an image map.
soundmap [waveform] This stage uses a sound meter from the sound system as an image map. Specify 'waveform' to get a scope rather than bars.
cubeMap <map> This stage uses a cube map as the image map. Looks for _px, _py, _pz, _nx, _ny, _nz for the positive x, y, z, and negative x, y, z sides.
cameraCubeMap <map> This stage uses a cube map in camera space. Looks for _forward, _back, _left, _right, _up, and _down.
ignoreAlphaTest Always use DEPTHFUNC_LEQUAL rather than DEPTHFUNC_EQUAL which is normally used for opaque and alpha tested surfaces.
nearest Use nearest texture filtering.
linear Use linear texture filtering.
clamp Same as the global keywords. Use to override a global clamp for a specific stage.
zeroclamp
alphazeroclamp
noclamp Use to set texture repeat for a stage when global clamp is set.
uncompressed Do not compress this image in medium quality mode.
highquality
forceHighQuality Do not compress this image in low quality mode.
nopicmip Ignore the image_downSize cvar.
vertexColor Multiply the pixel color by the vertex color.
inverseVertexColor Multiply the pixel color by one minus the vertex color.
privatePolygonOffset <float> Explicit larger (or negative) polygon offset for this stage.
texGen <type> Type is one of: normal, reflect, skybox, wobbleSky <exp> <exp> <exp>.
scroll <exp>, <exp> Scroll the texture coordinates.
translate <exp>, <exp>
scale <exp>, <exp> Just scales without a centering.
centerScale <exp>, <exp> Subtracts 0.5, then scales, then adds 0.5.
shear <exp>, <exp> Subtracts 0.5, then shears, then adds 0.5.
rotate <exp> Subtracts 0.5, then rotates, then adds 0.5.
maskRed Don't write to the red channel.
maskGreen Don't write to the blue channel.
maskBlue Don't write to the green channel.
maskAlpha Don't write to the alpha channel.
maskColor Shortcut for
maskRed
maskGreen
maskBlue 
maskDepth Don't write to the depth buffer.
alphaTest <exp> Only write if the alpha value is greater than <exp>.
red <exp> Set the red vertex color.
green <exp> Set the green vertex color.
blue <exp> Set the blue vertex color.
alpha <exp> Set the alpha vertex value.
rgb <exp> Shortcut for
red <exp>
green <exp>
blue <exp> 
rgba <exp> Shortcut for
red <exp>
green <exp>
blue <exp>
alpha <exp> 
color <exp0>, <exp1>, <exp2>, <exp3> Shortcut for
red exp0
green exp1
blue exp2
alpha exp3 
colored Shortcut for
color parm0, parm1, parm2, parm3 
if <exp> Conditionally disable stages.
fragmentProgram <prog> Use an ARB fragment program with this stage.
vertexProgram <prog> Use an ARB vertex program with this stage.
program <prog> Shortcut for
fragmentProgram <prog>
vertexProgram <prog> 
vertexParm <index> <exp0> [,exp1] [,exp2] [,exp3] Values to pass to the vertex program. One expression gets repeated across all 4 values. Two expressions put 0, 1 in z, w. Three expressions put 1 in w.
fragmentMap <index> [options] <map> The image map to use for texture unit <index>. [options] can be cubeMap, cameraCubeMap, nearest, linear, clamp, noclamp, zeroclamp, alphazeroclamp, forceHighQuality, uncompressed, highquality, or nopicmip.
megaTexture <mega> This stage uses a MegaTexture.


Image Program Functions

These can be used anywhere that accepts <map>, and can be nested.

heightmap(<map>, <float>) Turns a grayscale height map into a normal map. <float> determines how "deep" the bump map appears.
addnormals(<map>, <map>) Adds two normal maps together. Result is normalized.
smoothnormals(<map>) Does a box filter on the normal map, and normalizes the result.
add(<map>, <map>) Adds two images without normalizing the result.
scale(<map>, <float> [,float] [,float] [,float]) Scales the RGBA by the specified factors. Defaults to 0.
invertAlpha(<map>) Inverts the alpha channel (0 becomes 1, 1 becomes 0).
invertColor(<map>) Inverts the R, G, and B channels.
makeIntensity(<map>) Copies the red channel to the G, B, and A channels.
makeAlpha(<map>) Sets the alpha channel to an average of the RGB channels. Sets the RGB channels to white.