This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name | ### lightFalloff()
Examples |
    size(100, 100, P3D);
    noStroke();
    background(0);
    lightFalloff(1.0, 0.001, 0.0);
    pointLight(150, 250, 150, 50, 50, 50);
    beginShape();
    vertex(0, 0, 0);
    vertex(100, 0, -100);
    vertex(100, 100, -100);
    vertex(0, 100, 0);
    endShape(CLOSE);
Description | Sets the falloff rates for point lights, spot lights, and ambient lights. Like fill(), it affects only the elements which are created after it in the code. The default value is lightFalloff(1.0, 0.0, 0.0), and the parameters are used to calculate the falloff with the following equation: d = distance from light position to vertex position falloff = 1 / (CONSTANT + d * LINEAR + (d*d) * QUADRATIC) Thinking about an ambient light with a falloff can be tricky. If you want a region of your scene to be lit ambiently with one color and another region to be lit ambiently with another color, you could 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.
Syntax |
    lightFalloff(constant, linear, quadratic)
Parameters |
constant | float: constant value or determining falloff
linear | float: linear value for determining falloff
quadratic | float: quadratic value for determining falloff
Returns | void
Related | lights() ambientLight() pointLight() spotLight() lightSpecular()

Updated on October 26, 2013 08:58:32pm PDT