Vizard 7 » Reference » Lights » Light properties
7.7

Light properties

Position

The position of the light controls where the light is located if the w component is 1 (by default) or controls along which axis the source of a directional light is when w is 0.

mylight.position(0,0,0)

Direction

The direction property of the light controls which direction the light points in from its source. This only has affect when using a spot light.

mylight.direction(0,0,1)

Color

Intuitively the color of the light can be changed with the color function. For a quick overview white light is comprised of all other colors of light. Red objects will only reflect red light and blue objects will only reflect blue light. A white object will reflect all light.

#Add a light and color it red.
redLight = viz.addLight()
redLight.color( viz.RED )
#Add a white object to reflect the light.
ball = viz.add('white_ball.wrl')

Intensity

This controls the intensity of the light. There is no upper bound for the intensity.

mylight.intensity(2)

Spread

The spread value of a light can take values from 0 to 180. A spread of 180 is the default value and indicates a point light. Values between 0 and 90 represent the angle from the directional axis that light will span.

mylight.spread(180)

Spot Exponent

The spot exponent only applies to spot lights and controls how concentrated the light source is. By default the spot exponent is 0 and causes no attenuation within the area the light reaches. A higher spot exponent causes attenuation around the higher angles of the spot light.

mylight.spotexponent(3)

Attenuation

Attenuation of light is the loss in intensity of light over a distance. There are three portions to light decay which are constant, linear, and quadratic. By default the constant attenuation is 1 and both linear and quadratic attenuation are 0 which indicates no decay in intensity over distance.

mylight.linearattenuation(0.2)

Translate

The setPosition value will position the light in the world coordinates: x, y, z

mylight.setPosition(0,1,0)

See also

In this section:

Light basics

Adding lights

Lights Command Table

Other sections:

3D model basics

Scene basics

Example scripts:

Spotlight

Shadows