Creates a light that shines from a point in one direction.
Spot lights are like flashlights that shine in one direction creating a cone of light. The shape of the cone can be controlled using the angle and concentration parameters. A maximum of 5 spot lights can be active at once.
There are eight ways to call spotLight()
with parameters to set the light’s color, position, direction. For example, spotLight(255, 0, 0, 0, 0, 0, 1, 0, 0)
creates a red (255, 0, 0)
light at the origin (0, 0, 0)
that points to the right (1, 0, 0)
.
The angle
parameter is optional. It sets the radius of the light cone. For example, spotLight(255, 0, 0, 0, 0, 0, 1, 0, 0, PI / 16)
creates a red (255, 0, 0)
light at the origin (0, 0, 0)
that points to the right (1, 0, 0)
with an angle of PI / 16
radians. By default, angle
is PI / 3
radians.
The concentration
parameter is also optional. It focuses the light towards the center of the light cone. For example, spotLight(255, 0, 0, 0, 0, 0, 1, 0, 0, PI / 16, 50)
creates a red (255, 0, 0)
light at the origin (0, 0, 0)
that points to the right (1, 0, 0)
with an angle of PI / 16
radians at concentration of 50. By default, concentration
is 100.
Examples
Syntax
spotLight(v1, v2, v3, x, y, z, rx, ry, rz, [angle], [concentration])
spotLight(color, position, direction, [angle], [concentration])
spotLight(v1, v2, v3, position, direction, [angle], [concentration])
spotLight(color, x, y, z, direction, [angle], [concentration])
spotLight(color, position, rx, ry, rz, [angle], [concentration])
spotLight(v1, v2, v3, x, y, z, direction, [angle], [concentration])
spotLight(v1, v2, v3, position, rx, ry, rz, [angle], [concentration])
spotLight(color, x, y, z, rx, ry, rz, [angle], [concentration])
Parameters
PI / 3
.