Vera Visions Material Manual


3 General Material Keywords

IMPORTANT NOTE: Once again, be aware that some of the shader commands may be order dependent, so it's good practice to place all global shader commands (keywords defined inthis section) at the very beginning of the shader and to place shader stages at the end (see various examples).

These Keywords are global to a shader and affect all stages.

3.1 diffusemap <texturepath/texturename>

Specifies the default texture asset to use on the diffuse/albedo pass of the material. This is the base texture in most cases. Some special materials used for special effects and the like might not have one. However surfaces such as floors, walls etc. certainly do. It will affect which texture is used to get color information from for lighting passes, etc.

3.2 normalmap <texturepath/texturename>

Specifies the default texture to use for any normalmap operations. This depends heavily on which GLSL program is used inside the later stages. The dynamic lights will use this to determine height information for light and shadows. So sometimes you want to skip setting this.

3.3 specularmap <texturepath/texturename>

Can set the specularity of the surface in relation to dlights. Specularity is the intensity of the light reflecting off the surface. In special cases some GLSL programs might use the texture it for other purposes, too.

3.4 skyParms <farbox> <cloudheight> <nearbox>

Specifies how to use the surface as a sky, including an optional far box (stars, moon, etc), optional cloud layers with any shader attributes, and an optional near box (mountains in front of the clouds, etc). Some of the VMAP specific commands use this as a reference as to what skybox to use for color, intensity etc.

The renderer will take it into account only if you do not supply any Stages in the material.

<farbox> Specifies a set of files to use as an environment box behind all cloudlayers. Specify "-" for no farbox, or a file base name. A base name of "env/test" would look for files "env/test_rt.tga", "env/test_lf.tga", "env/test_ft.tga", "env/test_bk.tga", "env/test_up.tga", "env/test_dn.tga" to use as the right / left / front / back / up / down sides.
<cloudheight> controls apparent curvature of the cloud layers - lower numbers mean more curvature (and thus more distortion at the horizons). Higher height values create "flatter" skies with less horizon distortion. Think of height as the radius of a sphere on which the clouds are mapped. Good ranges are 64 to 256. The default value is 128.
<nearbox> Specified as farbox, to be alpha blended ontop of the clouds. This has not be tested in a long time, so it probably doesn't actually work. Set to "-" to ignore.

Example: Sky script

// Vera Visions Material
{
	qer_editorImage textures/skies/dune.tga
	skyParms textures/skies/dune/bg 256 -
	noPicMip
	noMipmaps

	vmap_lightmapFilterRadius 0 8
	vmap_sun 0.34 0.22 0.09 120 -28 127
	vmap_skyLight 190 6
	surfaceParm sky
	surfaceParm noimpact
	surfaceParm nolightmap
	surfaceParm nodlight
	{
		program skybox
		map $cube:textures/skies/dune/bg
		map textures/skies/clouds/dunecloud.tga
		map textures/skies/clouds/dunecloud_layer.tga
	}
}

3.5 cull <side>

Every surface of a polygon has two sides, a front and a back. Typically, we only see the front or "out" side. For example, a solid block you only show the front side. In many applications we see both. For example, in water, you can see both front and a back. The same is true for things like grates and screens.

To "cull" means to remove. The value parameter determines the type of face culling to apply. The default value is cull front if this keyword is not specified. However for items that should be inverted then the value back should be used. To disable culling, the value disable or none should be used. Only one cull instruction can be set for the shader.

3.5.1 cull front
The front or "outside" of the polygon is not drawn in the world. This is the default value. It is used if the keyword "cull " appears in the content instructions without a <side> value or if the keyword cull does not appear at all in the shader.

3.5.2 cull back
Cull back removes the back or "inside" of a polygon from being drawn in the world.

3.5.3 cull disable, cull none
Neither side of the polygon is removed. Both sides are drawn in the game. Very useful for making panels or barriers that have no depth, such as grates, screens, metal wire fences and so on and for liquid volumes that the player can see from within. Also used for energy fields, sprites, and weapon effects (e.g. plasma).

Design Notes: For things like grates and screens, put the texture with the cull none property on one face only. On the other faces, use a non-drawing texture.

3.6 fogparms <red value> <green value> <bluevalue> <distance to Opaque>

Note: you must also specify "surfaceparm fog" to cause q3map to identify the surfaces inside the volume. Fogparms only describes how to render the fog on the surfaces.

<red value> <green value> <blue value> These are normalized values. A good computer art program should give you the RGB values for a color. To obtain the values that define fog color for Quake III Arena, divide the desired color's Red, Green and Blue values by 255 to obtain three normalized numbers within the 0.0 to 1.0 range.
<distance toopaque> This is the distance, in game units, until the fog becomes totally opaque, as measured from the point of view of the observer. By making the height of the fog brush shorter than the distance to opaque, the apparent density of the fog can be reduced (because it never reaches the depth at which full opacity occurs).

Design Notes:

3.7 noPicMip

This causes the texture to ignore user-set values for the gl_picmip cvar command. The image will always be high resolution. Example: Used to keep images and text in the heads up display from blurring when user optimizes the game graphics.

3.8 noMipmaps

This implies noPicMip, but also prevents the generation of any lower resolution mipmaps for use by the 3d card. This will cause the texture to alias when it gets smaller, but there are some cases where you would rather have this than a blurry image. Sometimes thin slivers of triangles force things to very low mipmap levels, which leave a few constant pixels on otherwise scrolling special effects.

3.9 polygonOffset <value>

Surfaces rendered with the polygonOffset keyword are rendered slightly off the polygon's surface. This is typically used for wall markings and "decals." The distance between the offset and the polygon is variable. If no value is supplied a distance of 1 is assumed, however this is meant for backwards compatibility. Being explicit will help grepping values later in case you need to find all surfaces with just a polygonOffset of 1.

3.10 portal

Specifies that this texture is the surface for a portal or mirror. In the game map, a portal entity must be placed directly in front of the texture (within 64 game units). All this does is set "sort portal", so it isn't needed if you specify that explicitly.

3.11 sort <value>

Use this keyword to fine-tune the depth sorting of shaders as they are compared against other shaders in the game world. The basic concept is that if there is a question or a problem with shaders drawing in the wrong order against each other, this allows the designer to create a hierarchy ofwhich shader draws in what order.

The default behavior is to put all blended shaders in sort "additive" and all other shaders in sort "opaque", so you only need to specify this when you are trying to work around a sorting problem with multiple transparent surfaces in a scene.

The value here can be either a numerical value or (alternatively) one of the keywords in the following list (listed in order of mostly ascending priority):

Back | Home | Next