Lights

Up to 8 lights — Processing's own cap — combined with a Blinn-Phong shading model. Without any light call, Box()/Sphere() and custom 3D meshes draw flat and fully unlit, ignoring normals entirely, which is Processing's own documented default too.

3D renderer

On this page · 6 entries
The light list resets every frame. BeginDraw() clears all active lights, so Lights()/PointLight()/etc. need to be called again every Draw() to stay active — not just once in Setup(). This matches Processing's own documented requirement exactly. Lights past the 8-light cap are silently ignored, not an error.

Lights · NoLights

  • Lights()
  • NoLights()

Lights() turns on Processing's default rig — a mid-gray ambient light plus a mid-gray directional light shining straight along -Z — with LightFalloff(1,0,0) (no falloff) and LightSpecular(0,0,0) (no specular contribution). NoLights() clears everything back to flat/unlit.

AmbientLight

  • AmbientLight(r, g, b)
  • AmbientLight(r, g, b, x, y, z)

Uniform light that lights every surface regardless of orientation. The no-position overload is infinite and unattenuated; the positioned overload falls off with distance according to the current LightFalloff().

DirectionalLight

  • DirectionalLight(r, g, b, nx, ny, nz)

Shines from a fixed direction with no position and no distance falloff — think sunlight. (nx, ny, nz) is the direction the light travels from, matching Processing's own convention.

PointLight

  • PointLight(r, g, b, x, y, z)

Radiates equally in all directions from a position, attenuated by the current LightFalloff() with distance.

SpotLight

  • SpotLight(r, g, b, x, y, z, nx, ny, nz, angle, concentration)

A cone of light at (x, y, z), aimed along (nx, ny, nz). angle (radians) is the half-angle of the cone; concentration controls how sharply intensity falls off toward the cone's edge (higher = tighter hotspot). Also attenuated by LightFalloff() with distance.

LightFalloff · LightSpecular

  • LightFalloff(constant, linear, quadratic)
  • LightSpecular(r, g, b)

Style state affecting lights added after the call — like Fill()/Stroke(), not retroactive. LightFalloff() sets the distance-attenuation coefficients for point/spot/positional-ambient lights (Processing's own default: (1, 0, 0) — no falloff at all). LightSpecular() sets the color used for specular highlights and has no visible effect until Shininess() is above 0 — see Material properties.