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
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 ambient lit with one color and another region to be ambient lit 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.
size(400, 400, P3D); noStroke(); background(0); lightFalloff(1.0, 0.001, 0.0); pointLight(150, 250, 150, 200, 200, 200); beginShape(); vertex(0, 0, 0); vertex(400, 0, -400); vertex(400, 400, -400); vertex(0, 400, 0); endShape(CLOSE);
lightFalloff(constant, linear, quadratic)
(float)constant value or determining falloff
(float)linear value for determining falloff
(float)quadratic value for determining falloff
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.