COMMON PARAMETERS
This section provides explanation for some common parameters for the shaders in this volume of ShaderMan. It will be divided into three major subsections:
  • Illumination - explains the purpose of some of the parameters which are used in many of the shaders which use their own illumination model.
  • 3D Texturing - contains descriptions of parameters used for 3D texturing. These parameters are exactly the same as those found in some of LightWave's default textures (Fractal Noise for example).
  • 2D Texturing - 2D Texturing shaders give the user the option to choose between three methods of mapping 3D points (x,y,z) into 2D values (u,v): Planar, Cylindrical and Spherical. This sections gives an explanation of each mapping type.


  • Illumination



    3D Texturing



    2D Texturing


    2D procedural textures use u and v values to calculate the color of the texture at any point. Hence we need to determine u and v values from the space coordinates (x,y,z). This mapping can be done in three different ways:

    Planar mapping



    If a square side length of 1 unit were to be textured using a Planar Mapping then the value of uRep and vRep would represent the number of times the texture would wrap along the length and width respectively. A square of side length 2 units would wrap twice as many times in the u direction and twice as many times in the v direction. Hence depending on the size of the object that you are texturing, you will need to adjust the value of uRep and vRep. Often you will have to use values such as 0.2 or 0.05 in order to make the texture fit correctly.

    Cylindrical mapping



    In cylindrical mapping, the u value varies from 0 to 1 hence the value specified in uRep will be the number of time the texture wraps around in u direction. The value of v depends on the size of the object being textured. If the height of the object that we were texturing was 1 unit then the value vRep would be the number times the texture would wrap in the direction of the height. If the object was 2 units high, then the texture would wrap 2 * v times in that direction. Hence depending on the size of your object, you need to adjust the values of vRep. Bigger objects will require a smaller vRep when using cylindrical mapping.,

    Spherical mapping


    In spherical mapping, the values of uRep and vRep represent exactly the number of times the texture wraps in each direction, regardless of the size of the object being textured.

    In the three mapping methods above, Texture Axis determines how the above shapes are oriented for the mapping. In the cylindrical case for example, if the texture axis is X then the axis running through the middle of cylinder parallel to its height is aligned with the X axis. The same applies to the other mapping types.