Using the Combo Shader
return to main index |
|
GETTING STARTED This tutorial will demonstrate the use of a shader called combo. The shader has the following parameters,
float Ks = 0.7, /* specularity */
Kd = 0.5, /* diffuse */
Ka = 1, /* ambient */
roughness = .1, /* small is very smooth */
decalblend = 0, /* mixture of decal with texture */
envblend = 0, /* contribution of the environment map */
smovetex = 0, /* shift the texture in "s" */
tmovetex = 0, /* shift the texture in "t" */
smovetra = 0, /* shift the transparency map in "s" */
tmovetra = 0, /* shift the transparency map in "t" */
smovedecal = 0, /* shift the decal map in "s" */
tmovedecal = 0, /* shift the decal map in "t" */
smovedecalmask = 0, /* shift the decalmask in "s" */
tmovedecalmask = 0; /* shift the decalmask in "t" */
color specularcolor = 1; /* color of the reflection */
string texname = "", /* name of the texture map */
traname = "", /* name of the transparency map */
decalname = "", /* name of the decal map */
decalmask = "", /* name of the decal mask */
envname = "", /* name of the environment/reflection map */
specname = "", /* name of the specular map */
envspace = "world" /* coordinate system for the environment */
The parameters shown in purple enable a variety of texture maps to be used for a number of purposes. Those shown in red enable texture maps to be slid across a surface in the the 's' and 't' directions. Parameters shown in blue are used to adjust the contributions of the decal and environment maps. The following examples should clarify the ways in which combo can be used.
The code shown below is a snippet taken from the RIB file used to render the test frames.
|
||||||||||||||||||||
|
combo as a texture mapper ![]()
|
|
combo as an environment mapper ![]()
To apply a tiff image as an environment it is necessary to convert the image using the following statement in the RIB file, MakeLatLongEnvironment "greengrid.tif" "greengrid.tx" "gaussian" 2 2 The envblend parameter controls the visibility of the environment map - a value of zero will make the map invisible. |
|
combo as a decal mapper ![]()
In the example shown above the foreground image (decalname) has
been applied to the background image (texname) through the
stencil (decalmask).
|
|
combo as a decal / texture mover
In the animation shown below the values of the "smovedecal" and "smovedecalmask" change from 0 to 1.
In the final animation the values of the "tmovedecal" and "tmovedecalmask" change from 0 to 1 and at the same time the value of "smovetex" also changes from 0 to 1.
|
© 2002-4 Malcolm Kesson. All rights reserved.