ambient-light

directional-light

light-falloff

light-specular

lights

no-lights

normal

point-light

spot-light

ambient-light

Arguments
[red green blue][red green blue x y z]
Docstring
Adds an ambient light. Ambient light doesn't come from a specific direction,
the rays have light have bounced around so much that objects are
evenly lit from all sides. Ambient lights are almost always used in
combination with other types of lights. Lights need to be included
in the draw to remain persistent in a looping program. Placing them
in the setup of a looping program will cause them to only have an
effect the first time through the loop. The effect of the
parameters is determined by the current color mode.
Works only inside sketch functions?
Yes
Original Processing method
ambientLight()

directional-light

Arguments
[r g b nx ny nz]
Docstring
Adds a directional light. Directional light comes from one
direction and is stronger when hitting a surface squarely and weaker
if it hits at a gentle angle. After hitting a surface, a
directional lights scatters in all directions. Lights need to be
included in the draw fn to remain persistent in a looping
program. Placing them in the setup fn of a looping program will cause
them to only have an effect the first time through the loop. The
affect of the r, g, and b parameters is determined by the current
color mode. The nx, ny, and nz parameters specify the direction the
light is facing. For example, setting ny to -1 will cause the
geometry to be lit from below (the light is facing directly upward)
Works only inside sketch functions?
Yes
Original Processing method
directionalLight()

light-falloff

Arguments
[constant linear quadratic]
Docstring
Sets the falloff rates for point lights, spot lights, and ambient
lights. The parameters are used to determine the falloff with the
following equation:

d = distance from light position to vertex position
falloff = 1 / (CONSTANT + d * LINEAR + (d*d) * QUADRATIC)

Like fill, it affects only the elements which are created after it
in the code. The default value is (light-falloff 1.0 0.0 0.0).
Thinking about an ambient light with a falloff can be tricky. It is
used, for example, if you wanted a region of your scene to be lit
ambiently one color and another region to be lit ambiently by
another color, you would use an ambient light with location and
falloff. You can think of it as a point light that doesn't care
which direction a surface is facing.
Works only inside sketch functions?
Yes
Original Processing method
lightFalloff()

light-specular

Arguments
[r g b]
Docstring
Sets the specular color for lights. Like fill, it affects only the
elements which are created after it in the code. Specular refers to
light which bounces off a surface in a perferred direction (rather
than bouncing in all directions like a diffuse light) and is used
for creating highlights. The specular quality of a light interacts
with the specular material qualities set through the specular and
shininess functions.
Works only inside sketch functions?
Yes
Original Processing method
lightSpecular()

lights

Arguments
[]
Docstring
Sets the default ambient light, directional light, falloff, and
specular values. The defaults are:

(ambient-light 128 128 128)
(directional-light 128 128 128 0 0 -1)
(light-falloff 1 0 0)
(light-specular 0 0 0).

Lights need to be included in the draw to remain persistent in a
looping program. Placing them in the setup of a looping program
will cause them to only have an effect the first time through the
loop.
Works only inside sketch functions?
Yes
Original Processing method
lights()

no-lights

Arguments
[]
Docstring
Disable all lighting. Lighting is turned off by default and enabled
with the lights fn. This function can be used to disable lighting so
that 2D geometry (which does not require lighting) can be drawn
after a set of lighted 3D geometry.
Works only inside sketch functions?
Yes
Original Processing method
noLights()

normal

Arguments
[nx ny nz]
Docstring
Sets the current normal vector. This is for drawing three
dimensional shapes and surfaces and specifies a vector perpendicular
to the surface of the shape which determines how lighting affects
it. Processing attempts to automatically assign normals to shapes,
but since that's imperfect, this is a better option when you want
more control. This function is identical to glNormal3f() in OpenGL.
Works only inside sketch functions?
Yes
Original Processing method
normal()

point-light

Arguments
[r g b x y z]
Docstring
Adds a point light. Lights need to be included in the draw() to
remain persistent in a looping program. Placing them in the setup()
of a looping program will cause them to only have an effect the
first time through the loop. The affect of the r, g, and b
parameters is determined by the current color mode. The x, y, and z
parameters set the position of the light
Works only inside sketch functions?
Yes
Original Processing method
pointLight()

spot-light

Arguments
[r g b x y z nx ny nz angle concentration][[r g b] [x y z] [nx ny nz] angle concentration]
Docstring
Adds a spot light. Lights need to be included in the draw to
remain persistent in a looping program. Placing them in the setup
of a looping program will cause them to only have an effect the
first time through the loop. The affect of the r, g, and b
parameters is determined by the current color mode. The x, y, and z
parameters specify the position of the light and nx, ny, nz specify
the direction or light. The angle parameter affects angle of the
spotlight cone.
Works only inside sketch functions?
Yes
Original Processing method
spotLight()