Shadertype

New shadertypes .stype files - New shader templates that are applied to textures based on naming conventions (e.g. glass@lightbulb_off.dds applies the glass stype)

Location

Depending on the usecase, shadertypes are placed on different locations.

  • For 2D images (hud, menus, etc.), they are placed in shadertypes/2d

  • For map textures, they are placed in shadertypes/world

  • For xmodel textures, they are placed in shadertypes/model

Format

{
    // Global shader parameters
    parameter value

    // Stage 1
    {
        map $texturename
        // Stage-specific parameters
    }

    // Stage 2 (optional)
    {
        map textures/my_overlay
        // Stage-specific parameters
    }
}

Complete Stype Reference

2D Shadertypes

For HUD, menu, and UI elements

Name

Description

cursorhint

Cursor hint/indicator with alpha blending

warning

Warning indicator with blend

hud

HUD elements with vertex alpha and RGB

headicon

Head/player icons in HUD

menu

Menu background and elements

World Shadertypes

For map/world textures

Name

Description

alphashadow

Alpha-based shadow casting with lightmap

asphalt

Asphalt/road surface

asphalt_clampx

Asphalt with X-axis clamping

asphalt_clampy

Asphalt with Y-axis clamping

autosprite2_masked

Billboarded masked sprites

brick

Brick wall material

brick_clampx

Brick with X-axis clamping

brick_clampy

Brick with Y-axis clamping

carpet

Carpet/fabric surface

cloth

Cloth material for world objects

cloth_blend

Blended cloth material

cloth_light

Light-emitting cloth

cloth_masked

Masked/alpha cloth

concrete

Concrete surface

decal

Standard decal with lightmap

decal_asphalt

Asphalt-specific decal

decal_clamp

Clamped decal

decal_clampx

Decal with X-axis clamping

decal_clampy

Decal with Y-axis clamping

decal_depthwrite

Decal with depth writing

decal_metalnomask

Metal decal without alpha mask

decal_solid_clampy

Solid decal with Y clamping

dirt

Dirt/soil surface

dirt_clampx

Dirt with X-axis clamping

dirt_clampy

Dirt with Y-axis clamping

foliage

Foliage with alpha testing

foliage_blend

Blended foliage

foliage_clamp

Foliage with clamping

foliage_clampx

Foliage with X-axis clamping

foliage_clampy

Foliage with Y-axis clamping

foliage_masked

Masked foliage with lightmap

foliage_snow

Snow-covered foliage

glass

Standard glass with lightmap

glass_blend_in

Glass with inner blending

glass_blend_out

Glass with outer blending

glass_light

Light-emitting glass

glass_masked

Masked glass

glass_nosight

Opaque glass (blocks vision)

gravel

Gravel surface

gravel_clampy

Gravel with Y-axis clamping

grass

Grass with lightmap

grass_clampx

Grass with X-axis clamping

grass_clampy

Grass with Y-axis clamping

ice

Ice surface

ice_masked

Masked ice

metal

Standard metal surface

metal_cullnone

Metal without culling

metal_decal

Metal decal

metal_fence

Metal fence/grille (transparent)

metal_fence_nonsolid

Non-solid metal fence

metal_masked

Masked metal with alpha

metal_masked_solid

Solid masked metal

metal_objective

Objective-specific metal

mud

Mud surface

paper

Paper material

plaster

Plaster/wall material

rock

Rock surface

rock_clampx

Rock with X-axis clamping

rock_clampy

Rock with Y-axis clamping

sand

Sand surface

snow

Snow surface

snow_clamp

Snow with clamping

snow_clampx

Snow with X-axis clamping

snow_clampy

Snow with Y-axis clamping

water

Water surface

wood

Wood material

wood_clampx

Wood with X-axis clamping

wood_clampy

Wood with Y-axis clamping

wood_masked

Masked wood

Model Shadertypes

For xmodel (3D model) textures

Name

Description

body

Character body/flesh

brick

Brick texture

cloth

Cloth material

cloth_blend

Blended cloth

cloth_blend_in

Cloth with inner blending

cloth_blend_out

Cloth with outer blending

cloth_light

Light-emitting cloth

cloth_masked

Masked cloth

concrete

Concrete

decal

Decal

dirt

Dirt

flesh

Flesh/skin material

flesh_masked

Masked flesh

glass

Glass

glass_blend_in

Glass with inner blending

glass_blend_out

Glass with outer blending

glass_blend_out_broken

Broken glass with outer blending

glass_light

Light-emitting glass

glass_masked

Masked glass

grass

Grass

ice

Ice

metal

Metal

metal_env

Environment-mapped metal

metal_masked

Masked metal

mud

Mud

nofog_glass_blend_out

No-fog glass with outer blending

objective

Glowing objective marker (animated)

objective_incomplete

Incomplete objective marker (animated)

objective_incomplete_masked

Masked incomplete objective

objective_masked

Masked objective

paper

Paper

pickup

Glowing pickup item (animated)

pickup_masked

Masked pickup item

rock

Rock

sand

Sand

snow

Snow

tread_metal

Tank tread metal

tread_metal_masked

Masked tank tread metal

viewhands

First-person hands

viewmodel

First-person weapon/model

wheel_metal

Wheel/tire metal

wheel_metal_masked

Masked wheel metal

wood

Wood

wood_env

Environment-mapped wood (wet look)

wood_masked

Masked wood

Common Shadertype Patterns

Examples of common shadertype patterns from the game files, organized by category.

Basic Material Shadertypes

Simple glass (model)

{
    surfaceparm glass
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Simple metal (model)

{
    surfaceparm metal
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Simple wood (model)

{
    surfaceparm wood
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Simple cloth (model)

{
    surfaceparm cloth
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Simple water (model)

{
    surfaceparm water
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Simple snow (model)

{
    surfaceparm snow
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

World Surface Shadertypes

World glass with lightmap

{
    surfaceparm glass
    {
        map $texturename
        rgbGen exactVertex
    }
    {
        map $lightmap
        blendFunc filter
    }
}

World concrete with lightmap

{
    surfaceparm concrete
    {
        map $texturename
        rgbGen exactVertex
    nextbundle
        map $lightmap
    }
}

World grass with lightmap

{
    surfaceparm grass
    {
        map $texturename
        rgbGen exactVertex
    }
    {
        map $lightmap
        blendFunc filter
    }
}

World foliage with alpha and lightmap

{
    surfaceparm foliage
    surfaceparm nomarks
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Opaque glass (no sight, for special glass)

{
    surfaceparm opaqueglass
    {
        map $texturename
        rgbGen exactVertex
    }
    {
        map $lightmap
        blendFunc filter
    }
}

2D/UI Shadertypes

HUD elements

{
    nopicmip
    nomipmaps
    {
        map clamp $texturename
        blendFunc blend
        alphaGen vertex
        rgbGen vertex
    }
}

Cursor hint

{
    nopicmip
    nomipmaps
    {
        map clamp $texturename
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbGen vertex
    }
}

Warning indicator

{
    nopicmip
    nomipmaps
    {
        map $texturename
        blendFunc blend
    }
}

Head icon (HUD)

{
    nopicmip
    nomipmaps
    {
        map clamp $texturename
        blendFunc blend
        rgbGen vertex
    }
}

Transparent Material Shadertypes

Glass with blend in (model)

{
    surfaceparm glass
    sort innerBlend
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Glass with blend out (model)

{
    surfaceparm glass
    sort outerBlend
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

No-fog glass blend out (model - for special effects)

{
    surfaceparm glass
    sort outerBlend
    nofog
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Glass with light emission (model)

{
    surfaceparm glass
    surfaceparm noshadow
    {
        map $texturename
        rgbGen identityLighting
    }
}

World glass with transparency and lightmap

{
    surfaceparm glass
    surfaceparm trans
    sort innerBlend
    {
        map $texturename
        rgbGen exactVertex
        blendfunc blend
    nextbundle
        map $lightmap
    }
}

World glass blend out

{
    surfaceparm glass
    surfaceparm trans
    sort outerBlend
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Masked/Alpha Materials

Foliage masked (world)

{
    surfaceparm foliage
    surfaceparm trans
    surfaceparm alphashadow
    surfaceparm nomarks
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Foliage masked (model)

{
    surfaceparm nonsolid
    radialNormals
    {
        map $texturename
        rgbGen lightingDiffuse
        alphaFunc LT128
        depthWrite
    }
}

Metal masked (world)

{
    surfaceparm metal
    surfaceparm trans
    surfaceparm alphashadow
    surfaceparm nomarks
    surfaceparm nonsolid
    surfaceparm playerclip
    surfaceparm monsterclip
    nopicmip
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Metal masked solid (world)

{
    surfaceparm metal
    surfaceparm trans
    surfaceparm alphashadow
    surfaceparm nomarks
    surfaceparm nonsolid
    surfaceparm playerclip
    surfaceparm monsterclip
    nopicmip
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Wood masked (model)

{
    surfaceparm wood
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Cloth masked (model)

{
    surfaceparm cloth
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Flesh masked (model)

{
    surfaceparm flesh
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Pickup masked (model - glowing items)

{
    surfaceparm wood
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Environment Mapped Materials

Metal with environment map (model)

{
    surfaceparm metal
    nomipmaps
    {
        map textures/sfx/environmap_1day.jpg
        tcgen environment
        rgbgen lightingdiffuse
    }
    {
        map $texturename
        blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
        rgbgen lightingdiffuse
    }
}

Wood with wet environment map (model)

{
    surfaceparm wood_env
    nomipmaps
    nopicmip
    {
        map textures/sfx/environmap_wet.tga
        tcgen environment
        rgbgen lightingdiffuse
    }
    {
        map $texturename
        blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
        rgbgen lightingdiffuse
    }
}

Blended Materials

Cloth blend (model)

{
    surfaceparm cloth
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Foliage blend (model)

{
    surfaceparm nonsolid
    radialNormals
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Foliage blend (world)

{
    surfaceparm foliage
    surfaceparm nomarks
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    }
}

Cloth blend out (model)

{
    surfaceparm cloth
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Cloth blend in (model)

{
    surfaceparm cloth
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Special Purpose Shadertypes

Decal (model)

{
    surfaceparm nonsolid
    polygonOffset
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Decal (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Decal with depth write (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
        depthwrite
    nextbundle
        map $lightmap
    }
}

Alpha shadow (world)

{
    surfaceparm castshadow
    surfaceparm nomarks
    surfaceparm nolightmap
    surfaceparm alphashadow
    surfaceparm nonsolid
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Viewmodel (first-person weapon)

{
    surfaceparm metal
    nomipmaps
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Viewhands (first-person hands)

{
    surfaceparm flesh
    nomipmaps
    {
        map noopt $texturename
        rgbGen lightingDiffuse
    }
}

Metal fence (world)

{
    surfaceparm metal
    surfaceparm trans
    surfaceparm alphashadow
    surfaceparm nomarks
    surfaceparm nonsolid
    surfaceparm playerclip
    surfaceparm monsterclip
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Animated/Glowing Materials

Objective (model - glowing objective marker)

{
    {
        map $texturename
        rgbGen lightingDiffuse
    }
    {
        map $whiteimage
        rgbgen constLighting ( 0.20 0.158 0.062 )
        blendFunc add
    }

    {
        map $whiteimage
        rgbgen constLighting ( 0.8 0.632 0.252 )
        alphaGen wave sin -0.1 1.1 0 .5
        blendFunc GL_SRC_ALPHA GL_ONE
    }
}

Objective incomplete (model)

{
    {
        map $textureName
        rgbgen constLighting ( 0.40 0.316 0.124 )
        blendFunc add
    }
    {
        map $whiteImage
        rgbgen constLighting ( 0.8 0.632 0.252 )
        alphaGen wave sin -0.1 1.1 0 .5
        blendFunc GL_SRC_ALPHA GL_ONE
    }
}

Pickup (model - collectible items with glow)

{
    {
        map $texturename
        rgbGen lightingDiffuse
    }
    {
        map $texturename
        blendFunc add
        rgbGen wave sin 0.11 0.31 0 0.8
    }
}

Pickup masked (model)

{
    surfaceparm wood
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Objective masked (model)

{
    surfaceparm wood
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Objective incomplete masked (model)

{
    surfaceparm wood
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Terrain Materials

Dirt (world)

{
    surfaceparm dirt
    {
        map $texturename
        rgbGen exactVertex
    }
}

Rock (world)

{
    surfaceparm rock
    {
        map $texturename
        rgbGen exactVertex
    }
}

Brick (world)

{
    surfaceparm brick
    {
        map $texturename
        rgbGen exactVertex
    }
}

Mud (world)

{
    surfaceparm mud
    {
        map $texturename
        rgbGen exactVertex
    }
}

Sand (world)

{
    surfaceparm sand
    {
        map $texturename
        rgbGen exactVertex
    }
}

Plaster (world)

{
    surfaceparm plaster
    {
        map $texturename
        rgbGen exactVertex
    }
}

Bark (world)

{
    surfaceparm bark
    {
        map $texturename
        rgbGen exactVertex
    }
}

Ice (world)

{
    surfaceparm snow
    {
        map $texturename
        rgbGen exactVertex
    }
}

Clamped Texture Shadertypes

For textures that need clamping to avoid seam issues:

Foliage clamp X (world)

{
    surfaceparm foliage
    surfaceparm nomarks
    {
        map $texturename
        rgbGen exactVertex
        alphaFunc GE128
        depthWrite
    nextbundle
        map $lightmap
    }
}

Grass clamp Y (world)

{
    surfaceparm grass
    {
        map $texturename
        rgbGen exactVertex
    }
    {
        map $lightmap
        blendFunc filter
    }
}

Rock clamp Y (world)

{
    surfaceparm rock
    {
        map $texturename
        rgbGen exactVertex
    }
}

Dirt clamp Y (world)

{
    surfaceparm dirt
    {
        map $texturename
        rgbGen exactVertex
    }
}

Autosprite

Autosprite masked (world - for billboarded objects)

{
    surfaceparm nonsolid
    surfaceparm nomarks
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    }
}

Snow clamp X/Y (world)

{
    surfaceparm snow
    {
        map $texturename
        rgbGen exactVertex
    }
}

Decal Clamp Variants

Decal clamp (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Decal clamp X (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Decal clamp Y (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Decal metal no mask (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Decal solid clamp Y (world)

{
    surfaceparm nonsolid
    surfaceparm trans
    surfaceparm noncolliding
    polygonOffset
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Wheel Materials

Wheel metal (model)

{
    surfaceparm metal
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Wheel metal masked (model)

{
    surfaceparm metal
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Tread metal (model)

{
    surfaceparm metal
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

Tread metal masked (model)

{
    surfaceparm metal
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

No-Fog Materials

No-fog metal (model)

{
    surfaceparm metal
    {
        map $texturename
        rgbGen lightingDiffuse
    }
}

No-fog glass blend out (model)

{
    surfaceparm glass
    sort outerBlend
    nofog
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Glass variants

Broken glass blend in (model)

{
    surfaceparm nonsolid
    sort innerBlend
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Broken glass blend out (model)

{
    surfaceparm glass
    surfaceparm nonsolid
    sort innerBlend
    nomipmaps
    nopicmip
    {
        map $texturename
        rgbGen lightingDiffuse
        blendFunc blend
    }
}

Glass blend out (world)

{
    surfaceparm glass
    surfaceparm trans
    sort outerBlend
    {
        map $texturename
        rgbGen exactVertex
        blendFunc blend
    nextbundle
        map $lightmap
    }
}

Glass blend in (world)

{
    surfaceparm glass
    surfaceparm trans
    sort innerBlend
    {
        map $texturename
        rgbGen exactVertex
        blendfunc blend
    nextbundle
        map $lightmap
    }
}

Glass masked (world)

{
    surfaceparm glass
    surfaceparm trans
    surfaceparm nomarks
    {
        map $texturename
        rgbGen exactVertex
    }
}

Glass light (model)

{
    surfaceparm glass
    surfaceparm noshadow
    {
        map $texturename
        rgbGen identityLighting
    }
}

Fancy Animated Weapon Skin

// Made by Kazam
{
    surfaceparm metal
    nomipmaps
    {
        map textures/kazam_skins/purple_overlay1.dds
        tcMod scroll 0.0125 0.0125
        tcGen environment
    }
    {
        map textures/kazam_skins/starrysky_overlay2.dds
        blendFunc blend
        alphaGen wave sin -0.1 1.1 0 .125
        tcMod scroll 0.125 0.125
        tcMod rotate 5
    }
    {
        map textures/kazam_skins/starrysky_overlay2.dds
        blendFunc blend
        alphaGen wave sin -0.1 1.1 0 .25
        tcMod scroll -0.125 -0.125
        tcMod rotate -5
    }
}