Light Table


Related topics include:

For an overview and a list of lookup tables, see Lookup Tables.

Each entry of a light lookup table holds a light source definition.

------------------------------------------------------------------------------------------------------------
Table Value Mask                                                Description                    Fallback      PEX
 
------------------------------------------------------------------------------------------------------------
PEXLUTVLightType                                                                                             5.0
                                                                light type                    (imp-dep)
PEXLUTVLightDirection                                                                                        5.0
                                                                direction vector              (imp-dep)
PEXLUTVLightPosition                                                                                         5.0
                                                                position                      (imp-dep)
PEXLUTVLightConcentration                                                                                    5.0
                                                                concentration                 (imp-dep)
PEXLUTVLightSpreadAngle                                                                                      5.0
                                                                spread angle                  (imp-dep)
PEXLUTVLightConstantAttenFactor                                                                              5.0
                                                                constant attenuation factor   (imp-dep)
PEXLUTVLightLinearAttenFactor                                                                                5.0
                                                                linear attenuation factor     (imp-dep)
PEXLUTVLightColor                                                                                            5.0
                                                                light color                   (imp-dep)
PEXLUTVLightConcentrationClampRegion(a)                                                                      5.2
                                                                concentration clamp region    (imp-dep)
PEXLUTVLightQuadraticAttenFactor(a)                                                                          5.2
                                                                quadratic attenuation factor  (imp-dep)
PEXLUTVLightAll5_1 (selects entire table entry except 5.2 items)                                             5.0
PEXLUTVLightAll5_2 (selects entire table entry)                                                              5.2
 
------------------------------------------------------------------------------------------------------------

(a)
The requests PEXSetTableEntries, PEXGetTableEntries, PEXGetTableEntry, and PEXGetPredefinedEntries do not operate on the concentration clamp region or quadratic attenuation factor values of a light table entry.

PEXlib defines the following values:

light type:
PEXLightAmbient -
illuminates primitives uniformly independent of location and orientation.

PEXLightWCVector -
simulates light emanating from infinity along a particular direction.

PEXLightWCPoint -
simulates light emanating in all directions from a particular position. Control is provided over the rate at which the intensity drops off as a function of the distance from the light source.

PEXLightWCSpot -
simulates a spot light. This light emanates from a particular position within a cone of influence centered along a particular direction. Control is provided over the rate at which the intensity drops off both as a function of the distance from the light source and the distance from the center of the cone of influence. Additional control is provided over how sharply the intensity drops off along a region against the edge of the cone of influence.

Not every light type requires that you define all of the light table fields. The implementation ignores fields that are not needed for the definition of a particular light.

direction:
The vector (in WCs) along which the light travels from its source. Applies to the definition of light types PEXLightWCVector and PEXLightWCSpot.

position:
The location (in WCs) from which the light emanates. Applies to the definition of light types PEXLightWCPoint and PEXLightWCSpot.

concentration:
The factor used to define the rate at which a light's intensity drops off as a function of the distance from the center of the cone of influence to the edge of the cone of influence. Applies to the definition of light type PEXLightWCSpot.

spread_angle:
The angle (in radians) from the light source direction vector which defines the cone of influence of the light. The light has no affect on points which lie outside the cone of influence. Applies to the definition of light type PEXLightWCSpot.

constant_atten_factor:
The constant factor used in determining the rate at which the light's intensity falls off as a function of the distance from the light's position. Applies to the definition of light types PEXLightWCPoint and PEXLightWCSpot.

linear_atten_factor:
The linear factor used in determining the rate at which the light's intensity falls off as a function of the distance from the light's position. Applies to the definition of light types PEXLightWCPoint and PEXLightWCSpot.

light_color:
The light's color. Applies to the definition of all types of lights.

concentration_clamp_region:
The angle (in radians) inward from the cone of influence edge which defines a region along the outer portion of the cone influence. In this region the concentration is multiplied by a linear ramp which drops from 1.0 at the edge of the region to 0.0 at the edge of the cone of influence. This has the affect of clamping the light's intensity sharply down to zero at the edge of the cone of influence.

Inquire ConcentrationClampSupported with request PEXGetImpDepConstants to determine whether the concentration clamp region is actually applied in the reflectance calculation.

Applies to the definition of light type PEXLightWCSpot.

quadratic_atten_factor:
The quadratic factor used in determining the rate at which the light's intensity falls off as a function of the distance from the light's position.

Inquire QuadraticAttenSupported with request PEXGetImpDepConstants to determine whether the quadratic attenuation factor is actually used in the reflectance calculation.

Applies to the definition of light types PEXLightWCPoint and PEXLightWCSpot.

The reflectance equations are implementation-dependent.

The implementation accesses the light table during rendering whenever the pipeline state's light source state is non-empty. The light source state selects entries of the light table which then represent the enabled lights.

Direct color components that are out of range are treated in an implementation-dependent way. If you specify an unsupported color type, then the implementation issues a BadPEXColorType error. If the color type is PEXColorTypeIndexed and the color index is 65535, then the implementation issues a BadValue error. If you specify an unsupported light type or specify a direction vector of length zero, then the implementation issues a BadValue error.

Valid light table indices are in the range [1, 65535]. There is not a fallback entry for the light table.