Tables are a way to add variables into a modulation over time. There are 5 types of tables. Table, Snaptable, ClampTable, SnapClampTable, SoundTable. When using tables you’ll need 2 parts, the table and the table referenced in the shader. Use the tables.mtr when writing them.

Table: This is a string of numbers that can be referenced as a smooth modulation. If you use a table it will continue to loop.

Example: table decalFade { clamp { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 } }

Snaptable: This is a string of numbers that can be referenced as a non-smooth modulation. Example:

table table32 
{ 
        snap
        {
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
                16, 17, 18, 19, 20, 21, 22, 23 ,24, 25, 26, 27, 28, 29, 30, 31 
        }
}

Clamptable: are like tables, except they only go through their numeric string once, and remain at the last number.

Example: table brassScale { clamp { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }

SnapClampTables: are like ClampTables, except they are non-smooth modulation.

Example: table RouterOnOff { SnapClamp { 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0 } }

An example of a table being used in a shader, this material modulates the Red, Green and Blue values of the texture by the specified table. The table is stepped through once every second (time * .5)

textures/terminal/t3_htrim_01glow
{
        qer_editorimage textures/terminal/t3_htrim_01c_glowed.tga
        bumpmap addnormals      ( textures/terminal/t3_htrim_01c_local.tga, heightmap ( textures/terminal/t3_htrim_01_h.tga, 1 ) )
        specularmap             textures/terminal/t3_htrim_01c_s.tga       
        diffusemap              textures/terminal/t3_htrim_01c_d.tga
        
        {
                glow pass 
                blend add
                map     textures/terminal/t3_htrim_01c_g.tga
                rgb     terminalflicktable [time * .5]
        }

}

ArtReference Q4Shaders Tables (last edited 2005-11-04 21:47:58 by MattVainio)