Short Contents

6.3 Predefined Shader Parameters

Some shader parameters have a special meaning and should not be used to for a different purpose. These are all listed in the table below.

uniform string __category
Only meaningful as as light shader parameters, this string specifies the categories to which a light source belongs. Light categories are used to control what light sources are considered by constructs such as illuminance() and solar(). For example:
light donothing(
    string __category = "backlight,fog"; )
{
    shader body
}
More about light categories in Light Categories and a real-world example is shown in Listing 7.4.
uniform float __importancesample
Only meaningful as a light shader parameter, this scalar specifies if an area light with trace sampling strategy will make use of importance sampling. 0 will disable it, causing excessive noise in most cases.
{uniform|varying} float __nonspecular
Only meaningful as a light shader parameter, this scalar specifies to what extent this light contributes in specular(), specularstd() and phong(). Valid range is [0..1], 1 disabling completely the light in the aforementioned shadeops.
{uniform|varying} float __nondiffuse
Only meaningful as a light shader parameter, this scalar specifies to what extent this light contributes in the diffuse() shadeop. Valid range is [0..1], 1 disabling completely the light in the diffuse().

Noteworthy details about __nonspecular and __nondiffuse:

  1. These two parameters can be either uniform or varying. It is wasteful to declare them as varying if they do not change across the lit surface (which is almost always the case).
  2. If these parameters are uniform, it might be wiser to use light categories instead (see Light Categories) because light categories will exclude light sources prior to evaluation whereas these special parameters will be considered after light source evaluation, potentially leading to wasteful work.

3Delight 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.