wiki:Lighting

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

--

Light Types

LeoCAD supports 3 different types of lights:

  • Point Light

A Point Light (also known as Omni Light) emits light equally in all directions, like for example an emergency signal flare fired into the sky from a ship in distress.

  • Directional Light

A directional light produces infinitely-wide beams of parallel light, it appears to illuminate all objects with equal intensity, as if it were at an infinite distance from the objects so the position of the light doesn't matter, only its direction matters. A good example of a directional light is the sun.

  • Spot Light

A Spot Light is a light source which has a cone of effect, like a desk lamp for example. Like a Directional Light, it has a basic direction, but it also has a defined conic volume in which its light can fall and unlike a Directional Light, its position determines what objects it affects. The angle of the cone determines how much of the scene is illuminated.

Light Parameters

Once a light has been added to a scene you can change its parameters by using the Modify Dialog.

  • 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.

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 Point Lights and Spot 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.