kpq3 > shaders


Example..
shader/mapname/new_shader
{
    Compiler Paramaters
    General shader Paramaters
    {
        Stage Specific Paramaters
    }
}

General Shader Paramaters
Sort <type> (alternative numbers)
portal (1) This surface is a portal, it draws over every other shader seen inside the portal, but before anything in the main view.
(2) Sort not used in shaders
sky (3) 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 (4) This surface is opaque (rarely needed since this is the default with no blendfunc)
skyNoFog(5) Dont add fog to sky(sames as using "skyNoFog"
decal (6) : Scorch marks, etc.
seeThrough (7) : lLadders, grates, grills that may have small blended edges
banner (8): Transparent, but very close to walls.
fog (9) : Fog
underwater (10) : For items that should be drawn in front of the water plane.
water (11)  
far (12)  
medium (13)  
close (14)  
additive (16) Normal transparent surface (default for shaders with blendfuncs)
almostNearest (20) Gun smoke puffs
nearest (21) This shader should always sort closest to the viewer, e.g. muzzle flashes and blend blobs
postProcess (22) IMage manipulation, requires the scene to be rendered.

deformVertexes <type> (deform vertex modes)
projectionShadow
autoSprite
autoSprite2
text <0-7>
bulge <bulgeWidth> <bulgeHeight> <bulgeSpeed>
wave <spread> <waveform> <base> <amplitude> <phase> <frequency>
normal <frequency> <amplitude>
move <vector> <waveform> <base> <amplitude> <phase> <frequency>
sprite
flare <size>

surfaceparm <name> (note: can be used without surfaceparm key word)
water origin missileclip
slag trans playerclip
slime translucent monsterclip
lava detail botclip
blood (aka water) structural ladder
slick hint collision
flesh areaportal  
  clusterportal metalsteps
nodrop donotenter gravelsteps
nonsolid   metallightsteps
noimpact fog rugsteps
nomarks sky snowsteps
nodlight lightfilter woodsteps
nosteps alphashadow icesteps
nodraw   grassteps
nooverlays   marblesteps
nodamage   metaltinsteps
nolightmap   glassteps
pointlight    

General/Doom3 shader paramaters
dust
metal
stone
wood
trigger
discrete (detail)
DECAL_MACRO
DECAL_ALPHATEST_MACRO

Keyword <image> (note: shorthand for (stage <type>) )
colorMap <image> skyboxMap <image>
diffuseMap <image> screenMap <image>
bumpMap <image> portalMap <image>
normalMap <image> (dupe above) heathazeMap <image>
specularMap <image> attenuationMapXY <image>
glowMap <image> attenuationMapZ <image>
reflectionMap <image> lightFalloffImage <image>
reflectionMapBlended <image>  

General Global Keyword
noShadows skyparms <cubemap | -> <cloudheight> <cubemap | ->
volumetricLight skyfogvars <( R G B)> <density>
translucent waterfogvars <( R G B)> <density>
forceOpaque fogvars <( R G B)> <fogDensity>
nomipmap | nomipmaps sunshader <sunShaderName>
nopicmip lightgridmulamb <flot>
allowcompress lightgridmuldir <flot>
nocompress cull <twoSided | backside | >
polygonOffset <float> twoSided
parallax backSided
entityMergable clamp | edgeClamp | zeroClamp | alphaZeroClamp | noClamp
fogParms <( Red Green Blue )> <depth> implicit <implicitBlend | implicitMask | implicitMapGL1 | implicitMap> <image>
noFog spectrum <int>
portal <range> when <shadername>
mirror  

 

Compiler only Shader Paramaters
kmap_ compiler options
kmap_skylight <> <> kmap_baseShader kmap_tcGen
kmap_surfacelight <> kmap_backsplash kmap_colorGen
kmap_sun kmap_bounce kmap_colorMod
kmap_sunExt kmap_bounceScale kmap_rgbGen
kmap_sunext kmap_tessSize kmap_rgbMod
kmap_lightimage kmap_normalimage kmap_alphaGen
kmap_lightmapSampleSize kmap_surfacemodel kmap_alphaMod
kmap_lightmapSampleOffset kmap_foliage kmap_tcMod
kmap_lightmapFilterRadius kmap_skyLight kmap_vertexScale
kmap_lightmapAxis kmap_surfacelight kmap_flare
kmap_lightmapSize kmap_lightStyle kmap_flareShader
kmap_lightmapBrightness kmap_lightRGB kmap_backShader
kmap_nodirty kmap_lightSubdivide kmap_cloneShader
kmap_noclip kmap_floodLight kmap_remapShader
kmap_notjunc kmap_forceSunlight kmap_deprecateShader
kmap_noVertexLight kmap_offset kmap_globaltexture
kmap_onlyVertexLighting kmap_forceMeta kmap_indexed
kmap_fur kmap_nonplanar kmap_material
kmap_terrain kmap_fogDir kmap_textureSize
kmap_clipmodel kmap_noVertexShadows kmap_lightmapMergable
kmap_styleMarker kmap_nofog kmap_patchShadows
kmap_styleMarker2 kmap_noFast kmap_vertexShadows
kmap_shadeAngle kmap_invert kmap_splotchfix

 

Global Image Manipulation(use anywhere)
combine/edit input image
 heightMap(<map>, <float>) Turns a grayscale height map into a normal map. <float> varies the bumpiness
displaceMap(<map>, <map>) Sets the alpha channel to an average of the second image's RGB channels.
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.
addGloss (<map>, <map>) add alpha gloss map to rgb specular map (light reflection level)

 

Stage specific Paramaters

stage <type>

colorMap dispersionMap (N/A)
diffuseMap skyboxMap
bumpMap screenMap
normalMap (dupe above) portalMap
specularMap heathazeMap
glowMap liquidMap (N/A)
reflectionMap attenuationMapXY
refractionMap (N/A) attenuationMapZ
 
blend <shorthand> (expanded to)
blend add ( GL_ONE, GL_ONE )
blend filter ( GL_DST_COLOR , GL_ZERO )
blend modulate ( GL_DST_COLOR , GL_ZERO )
blend blend ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA )
blend none ( GL_ZERO, GL_ONE )
   
blend diffuseMap ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA )
blend bumpMap ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA )
blend specularMap ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA )
blend glowMap ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA )
 
blend <source>, <destination>
<Source Modes>
GL_ONE
GL_ZERO
GL_DST_COLOR
GL_ONE_MINUS_DST_COLOR
GL_SRC_ALPHA
GL_ONE_MINUS_SRC_ALPHA
GL_DST_ALPHA
GL_ONE_MINUS_DST_ALPHA
GL_SRC_ALPHA_SATURATE
 
<Destination Modes>
GL_ONE
GL_ZERO
GL_SRC_ALPHA
GL_ONE_MINUS_SRC_ALPHA
GL_DST_ALPHA
GL_ONE_MINUS_DST_ALPHA
GL_SRC_COLOR
GL_ONE_MINUS_SRC_COLOR
 
map <image> (specific image types)
map <image>  
cubemap <image> Note: eg.. "_autocube" "cubemaps/hipshot/violentdays"
animMap <speed> <image> <image n..> Note: max 24 images>
videomap <video.ogv>  
clampmap <image>  
 
map <type> (preset texture maps)
_white $white $whiteimage *white
_black $black $blackimage *black
_flat $flat $flatimage *flat
_grey $grey _gray $gray
_red
_green
_blue
_scratch
_quadratic
 

rgbgen <type> (note: stage specific color generation modes)

wave <sin | square | triangle | sawtooth | inversesawtooth | noise> <base> <amp> <phase> <freq>
const <(R G B)>
identity
identityLighting
entity
oneMinusEntity
vertex
exactVertex
lightingDiffuse ( diffusemap, using surface lightmap color)
oneMinusVertex
 

alphaGen <type> (note: stage specific alpha generation modes)

wave <sin | square | triangle | sawtooth | inversesawtooth | noise> <base> <amp> <phase> <freq>
const <float>
identity
entity
oneMinusEntity
vertex
oneMinusVertex

Shorthand rgbGen key words
rgb <float> note: constant RGB value
red <float> note: constant red value
green <float> note:constant green value
blue <float> note: constant blue value
colored note: rgbgen entity
vertexColor note: rgbGen vertex + alphaGen vertex
inverseVertexColor note: rgbGen oneMinusVertex + alphaGen oneMinusVertex

texGen / tcGen <type> (note: texture render methods)
environment
reflect (stage REFLECTIONMAP)
skybox (stage skyboxmap)
 
tcMod <type>
turb <base> <amplitude> <phase> <frequency>
scale <scale> <scale>
scroll <scroll> <scroll>
stretch <sin | square | triangle | sawtooth | inversesawtooth | noise> <base> <amplitude> <phase> <frequency>
transform <matrix> <matrix> <matrix> <matrix> <matrix> <matrix>
rotate <rotateSpeed>
entityTranslate
 
General key words


alpha <arithmetic expression> maskRed
alphaTest <float> (or table) maskGreen
alphafunc <GT0 | LT128 | GE128 |LTENT | GTENT> maskBlue
  maskAlpha
privatePolygonOffset <float> maskColor
color <exp>, <exp>, <exp>, <exp> maskColorAlpha
depthfunc <lequal | equal>  
  maskDepth
scroll <> <> writeDepth
translate <> <> depthwrite (dupe above)
scale <> <>  
centerScale <> <> nearest
shear <> <> linear
rotate <> noPicMip
  uncompressed
fresnelScale highQuality
normalScale forceHighQuality
depthScale ignoreAlphaTest
   
deformMagnitude fog <on>
blurMagnitude fogDensity
refractionIndex  
fresnelPower wireFrame
fresnelBias wrapAroundLighting
stencil <front|back|both> [mask <mask>] [writeMask <mask>] <ref> <op> <sfail> <zfail> <zpass>
 
texture clamp modes
clamp
edgeClamp
zeroClamp
alphaZeroClamp
noClamp
 
stencil <side> [mask <mask>] [writeMask <mask>] <ref> <op> <sfail> <zfail> <zpass>
<side> = <front|back|both>
<mask> = <0-255>
<writeMask> = <0-255>
<ref> = <int>
<op> = <always|never|less|lequal|greater|gequal|equalnequal>
<sfail> = <keep|replace|invert|incr|decr>
<zfail> = <keep|replace|invert|incr|decr>
<zpass> = <keep|replace|invert|incr|decr>