|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Shader | Reflectance
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| Synopsis |
Reflectance shader that provides support for surface property trees.
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| Location | lishclas | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
A shader which provides the entry point to support surface property
trees. This shader switches between two sets of surface properties
and illumination models defined by the corresponding sets of shaders:
Switching between the two sets of properties is accomplished using the alpha shader global. This global is calculated by a transparency shader which is passed to the decal reflectance shader through the "selector" parameter. The calculated value of alpha is used as a switching coefficient (m). It divides the surface into two areas:
Placing decals on the base surface corresponds to placing one, possibly semi-transparent, object (the decal) onto another (the base). It has the following implications for the way the surface properties (normal, transparency, colour) are calculated in each area. In the {\b base area} the shading process simply uses the base shaders. In the {\b decal area} the results obtained at each stage of the shading pipeline are combinations of the results of applying the appropriate base and decal shaders at that stage of the pipeline. The proportions in which the base and decal shaders influence the surface appearance depend not only on the value provided by the "selector" shader, but also on the value of the "decal transparency" shader passed as an argument to the decal reflectance shader. The blending coefficient cblend used to combine base and decal shaders is therefore calculated as:
cblend = m * a_d,
where a_d is the alpha value calculated by the "decal transparency" shader. If there is no "decal transparency" shader, then the blending coefficient is simply equal to m. A blending coefficient of 0.0 means that only base shaders determine the surface appearance. In other words, where the decal is transparent, only the base surface properties (as determined by the displacement, colour and reflectance shaders) are included in the final result. The results of the base and decal shaders are combined as follows. Displacement:
Transparency:
Colour: The colours of the base and decal areas are calculated using the corresponding colour and reflectance shaders. In the areas where the blending coefficient is in the range 1.0 > cblend > 0.0 the final colour is calculated as a linear interpolation of the colours calculated by the decal and base reflectance shaders. The blending coefficient is used in the linear interpolation. The decal reflectance shader takes several other shaders as parameters. The default values for each of these shaders is NULL. If a NULL shader parameter is assigned (or left as default) then the corresponding value (colour, normal, transparency) will remain unchanged. This is equivalent to applying the shader originally assigned to the surface. Having NULL for the base or decal reflectance shaders is equivalent to using dummy "constant" reflectance shaders. Using the "decal texture space" parameter, it is possible to define a texture space shader for use in the decal area. The "keep base texture space" parameter determines which texture space will be applied to the shaders in the base branch of the decal reflectance shader in the shade tree. If this parameter is set to TRUE, then the original texture space assigned to the primitive will be restored before executing the base shaders of this decal shader. If set to FALSE then the base shaders will be executed using the texture space co-ordinates calculated by their parent shader in the shader tree. Note that "keep base texture space" only affects shaders assigned directly to the decal shader for which the parameter is set. This property is not inherited by child decal shaders. To use the primary texture space for shaders in the base branches at all levels of the shade tree then it is necessary to set the "keep base texture space" parameter appropriately for each used reflectance decal shader.
Previous page alphabetically (decal) | |||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 1990-2004, 2005 LightWork Design Limited. All rights reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||