lights()#

Sets the default ambient light, directional light, falloff, and specular values.

Examples#

example picture for lights()

def setup():
    py5.size(100, 100, py5.P3D)
    py5.background(0)
    py5.no_stroke()
    # sets the default ambient
    # and directional light
    py5.lights()
    py5.translate(20, 50, 0)
    py5.sphere(30)
    py5.translate(60, 0, 0)
    py5.sphere(30)

example picture for lights()

def setup():
    py5.size(100, 100, py5.P3D)
    py5.background(0)
    py5.no_stroke()


def draw():
    # include lights() at the beginning
    # of draw() to keep them persistent
    py5.lights()
    py5.translate(20, 50, 0)
    py5.sphere(30)
    py5.translate(60, 0, 0)
    py5.sphere(30)

Description#

Sets the default ambient light, directional light, falloff, and specular values. The defaults are ambientLight(128, 128, 128) and directionalLight(128, 128, 128, 0, 0, -1), lightFalloff(1, 0, 0), and lightSpecular(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.

Underlying Processing method: lights

Signatures#

lights() -> None

Updated on March 06, 2023 02:49:26am UTC