Texture guides are the shorthanded versions of texture shader entries ONLY. It basically references a template to be used. Use the guides first, since if they’re generally easier to write, and save space in out material files, and nearly impossible to mess up.

Here’s an example of a texture guide line:

guide textures/terminal/t1_wall1 generic_shader("terminal/t1_wall1")

"Generic_shader" is THE basic shader. It will show the basic base texture in game. If you use this shader it will default to solidmetal as the material type.


Lets break the above example down piece by piece:

Guide – this lets the game know to reference a guide. This looks for a template in the materials.guide file.

Textures/terminal/t1_wall – is the shader title, so this is what shows up in the editor, and is referenced by the game.

Generic_shader is the type of shader being used. There are a lot of different generic shaders, and depending on what you want the texture to do, this name may change. (i.e. generic_glow, generic_alpha, etc,) There is a listing all of the current generic shaders at the end of this section.

(“terminal/t1_wall1”) is the targa being referenced.

You’re probably wondering where these templates are, what the guide references, and what they look like and do.

guide generic_shader(TextureParm)
{
        qer_editorimage textures/TextureParm_d

        bumpmap addnormals ( textures/TextureParm_local, heightmap ( textures/TextureParm_h, 1 ) )
        diffusemap      textures/TextureParm_d
        specularmap     textures/TextureParm_s
}

As you can see, they look exactly like a long hand version of a texture shader, but the targa entries use a TextureParm entry. Place the shader title between the guide and generic_shader entries. That entry will be what appears in the editor. The TextureParm in the shader title replaces all of the TextureParm entries in the body of the shader. So in the terminal/t1_wall1 example above it would do the following:

guide textures/terminal/t1_wall1 generic_shader("terminal/t1_wall1")
{
        qer_editorimage textures/terminal/t1_wall1_d

        bumpmap addnormals ( textures/terminal/t1_wall1_local, heightmap ( textures/ terminal/t1_wall1_h, 1 ) )
        diffusemap      textures/terminal/t1_wall1_d
        specularmap     textures/terminal/t1_wall1_s
}

You can write any number of shader guides, but there’s a point where you should just write it long hand… here’s an example of a shader guide that uses more than one parm:

guide generic_glow(TextureParm, Glowparm)
{
        qer_editorimage textures/TextureParm_d

        bumpmap addnormals ( textures/TextureParm_local, heightmap ( textures/TextureParm_h, 1 ) )
        diffusemap      textures/TextureParm_d
        specularmap     textures/TextureParm_s
        {
                blend           GL_ONE, GL_ONE
                map             textures/Glowparm

                red             Parm0  
                green           Parm1  
                blue            Parm2  
        }
}

It would be written as a texture guide like this:

guide textures/terminal/t_shaft1 generic_glow("terminal/t_shaft1", "terminal/t_shaft1_g")

If you have Multiple Parameters in the shader guide they must be separated by a comma and a space, all parameters need to be in quotes and the whole parameter section must be opened and closed by parentheses.

The first entry is the TextureParm while the second is the GlowParm. If you’re writing a new shader guide or using an existing guide, you should take a look at how they’ve been written, since sometimes the parameters may have been switched or moved. If you decide to write a shader guide try to name it something fairly descriptive, since generic_1 isn’t a good way to keep things in order. Generic_1 tells me nothing of what the shader can do at a glance, but generic_glow does.

Here’s a listing of the current shader guides:


Generic guides:

guide generic_shader(TextureParm) – base generic shader
guide generic_shader2sided(TextureParm) – generic 2 sided shader
guide generic_shader_mi(TextureParm) – generic shader with an impact image.
guide generic_typeshader(TextureParm, TypeParm ) – generic shader with one impact surface. You’ll need to enter a type impact name.

guide generic_full_noheight(TextureParm) – a shader that uses no height map

guide generic_shader_heightmap(TextureParm, Heightparm) – a shader with a height parameter variable.

guide generic_nonormal(TextureParm) – a shader with no normal map
guide generic_nonormal_height(TextureParm, Heightparm) – a shader with no normal and can change the numerical entry of the height pass.
guide generic_nonormal_height_type(TextureParm, Heightparm, TypeParm ) – no local map, with a height variable, and can call out an impact type

guide generic_Localvariant(LocalParm, TextureParm) – a shader that uses a different local map
guide generic_Localvariant_mi(LocalParm, TextureParm) - local variant with a material image

guide generic_colorvariant(VariantParm, TextureParm) – shader that uses a different diffuse variant
guide generic_colorvariant_mi(VariantParm, TextureParm) – generic shader using a different diffuse with a material image

Alpha

guide generic_alpha(TextureParm) – hard edged alpha
guide generic_alpha_mi(TextureParm) – hard edged alpha with a material image
guide generic_alpha_type(TextureParm, TypeParm) – hard edged alpha with an impact type.

guide generic_shader2sidedalpha_mi(TextureParm) – 2 sided hard edged alpha with material image
guide generic_shader2sidedalpha(TextureParm) – 2 sided hard edged alpha

guide generic_alpha_lv(TextureParm, LocalParm) – hard edged alpha local variable
guide generic_shader2sidedalpha_lv(TextureParm, LocalParm) – 2 sided hard edged alpha with a local variant.

guide generic_alphaNoShadow2S(TextureParm) – hard edged alpha, no shadow, 2 sided.

Glow passes

guide generic_glow(TextureParm, Glowparm) – a shader with a glow pass
guide generic_glow_mi(TextureParm, Glowparm) – glow pass with a material image

guide generic_alphaglow(TextureParm, Glowparm) – hard edged alpha with a glow pass

guide generic_glowflicker(TextureParm, Glowparm, Flickerparm) – glow pass with a flicker table
guide generic_glowflicker2(TextureParm, Glowparm1, Flickerparm1, Glowparm2, Flickerparm2) – 2 glow passes, 2 tables (should probably write it long hand)

ArtReference Q4Shaders Guides (last edited 2006-01-22 23:56:06 by MattBreit)