light3D

Block Category: Animation

Description: The light3D block lets you create and adjust the direction of the light in a 3D animation.

The light3D block is a DirectX block; it recognizes the following coordinate system:

DirectX%20coordinate%20system

Inputs to the light3D block are described in the table below. The light3D parameters determine the inputs necessary for the type of light you are creating.

Input

Function

Structure

Diffuse

Diffuse color emitted by the light. Diffuse light depends on both the light direction and the object surface normal. It varies across the surface of an object because of the changing light direction and the changing surface numeral vector. It takes longer to calculate diffuse lighting because it changes for each object and gives them 3D depth.

Four-element vector consisting of:
r: Floating-point value specifying the red component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
g: Floating-point value specifying the green component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
b: Floating-point value specifying the blue component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
a: Reserved. Enter a value of 1.0.

Specular

Specular color emitted by the light. Specular lighting identifies the bright specular highlights that occur when light hits an object surface and reflects toward the camera. It is more intense than diffuse light and falls off more rapidly across the object surface. It takes longer to calculate specular lighting than diffuse lighting; however, the benefit of using it is that it adds significant detail to a surface.

Four-element vector consisting of:
r: Floating-point value specifying the red component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
g: Floating-point value specifying the green component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
b: Floating-point value specifying the blue component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
a: Reserved. Enter a value of 1.0.

Ambient

Ambient color emitted by the light. Ambient lighting is constant lighting. It is constant in all directions and it colors all pixels of an object the same. It is fast to calculate, but it leaves objects looking flat and unrealistic.

Four-element vector consisting of:
r: Floating-point value specifying the red component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
g: Floating-point value specifying the green component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
b: Floating-point value specifying the blue component of a color. This value generally is in the range from 0.0 – 1.0, with 0.0 being black.
a: Reserved. Enter a value of 1.0.

Position

Position of the light in world space. When Directional Light is specified, this input has no meaning.

Three-element vector, where each element is a floating-point value.

Direction

Direction that the light is pointing in world space. When Directional Light or Spotlight is specified, this input has no meaning.

Three-element vector, where each element is a floating-point value.

Range

Distance beyond which the light has no effect. This input does not affect directional light.

Floating point value.

Falloff

Decrease in illumination between a spotlight's inner cone (the angle specified by Theta) and the outer edge of the outer cone (the angle specified by Phi).

The effect of falloff on the lighting is subtle. Furthermore, a small performance penalty is incurred by shaping the falloff curve. For you should set this value to 1.0.

Floating point value.

Attenuation

How light intensity changes over distance. Attenuation values are ignored for directional light.

Three-element vector. Valid values range from 0.0 – infinity. For non-directional light, all three values should not be set to 0.0 at the same time.

Theta

Angle, in radians, of a spotlight's inner cone - that is, the fully illuminated spotlight cone. This value must be in the range from 0 through the value specified by Phi.

Floating point value.

Phi

Angle, in radians, defining the outer edge of the spotlight's outer cone. Points outside this cone are not lit by the spotlight. This value must be between 0 and pi.

Floating point value.

The information in the above table is from the online MSDN. Refer to http://msdn2.microsoft.com/en-us/library/bb172566(VS.85).aspx for more complete descriptions of these inputs.

Directional: Directional light has color and direction that you can control, but not position. The light it generates is referred to as parallel light; that is, all directional light travels through an object in the same direction. If you choose Directional, you must provide input to the three color input connectors and the direction input connector on the light3D block.

Point: Point light has color and position that you can control; however, it has no single direction. That is, it gives off light equally in all directions. If you choose Point, you must provide input to the three color input connectors, along with input to the position, range, and attenuation input connectors on the light3D block.

Spot: Spot light has color, position, direction that you can control. The light emitted from a spot light has a narrowly focused inner cone of light as well as an outer cone of light. The light intensity diminishes as it reaches the outer cone, and there is no light beyond the outer cone. To control the size of the inner and outer cones, the elements Phi and Theta are used. The following illustration shows the relationship between these elements:

spotlight

If you choose Spot, you must provide input to all the input connectors on the light3D block.