Version 1 (modified by leo, 10 years ago) (diff)


Light Types

  • Omni Light
  • Spot Light (spot/directional)

Light Parameters

Ambient Color

The ambient component is the light from this source that's been scattered so much by the environment that its direction is impossible to determine - it seems to come from all directions. Backlighting in a room has a large ambient component, since most of the light that reaches your eye has bounced off many surfaces first. A spotlight outdoors has a tiny ambient component; most of the light travels in the same direction, and since you're outdoors, very little of the light reaches your eye after bouncing off other objects. When ambient light strikes a surface, it's scattered equally in all directions.

Diffuse Color

Diffuse light comes from one direction, so it's brighter if it comes squarely down on a surface than if it barely glances off the surface. Once it hits a surface, however, it's scattered equally in all directions, so it appears equally bright, no matter where the eye is located. Any light coming from a particular position or direction probably has a diffuse component.

Specular Color

Specular light comes from a particular direction, and it tends to bounce off the surface in a preferred direction. A well-collimated laser beam bouncing off a high-quality mirror produces almost 100 percent specular reflection. Shiny metal or plastic has a high specular component, and chalk or carpet has almost none. You can think of specularity as shininess.

Spot Exponent

This parameter controls how concentrated the light of a spot light is. The light's intensity is highest in the center of the cone and it's attenuated toward the edges of the cone by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lighted, raised to the power of the spot exponent. Thus, higher spot exponents result in a more focused light source.

Only values between 0 and 128 are valid, with 0 (the default) resulting in uniform light distribution.

Spot Cutoff

Specifies the maximum spread angle of a light source (between 0 and 90 degreees). If the angle between the direction of the light and the direction from the light to the vertex being lit is greater than the spot cutoff angle, then the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors.

Constant/Linear/Quadratic? Attenuation

For real-world lights, the intensity of light decreases as distance from the light increases. Since a directional light is infinitely far away, it doesn't make sense to attenuate its intensity over distance, so attenuation is disabled for a directional light. However, you might want to attenuate the light coming from spot and omni lights.

Light intensity is attenuated by the reciprocal of the sum of: the constant factor, the linear factor multiplied by the distance between the light and the vertex being lit, and the quadratic factor multiplied by the square of the same distance. If the Attenuation factors are (1, 0, 0), it would result in no attenuation at all.