Reference lightFalloff()

lightFalloff()

Sets the falloff rate for pointLight() and spotLight().

A light’s falloff describes the intensity of its beam at a distance. For example, a lantern has a slow falloff, a flashlight has a medium falloff, and a laser pointer has a sharp falloff.

lightFalloff() has three parameters, constant, linear, and quadratic. They’re numbers used to calculate falloff at a distance, d, as follows:

falloff = 1 / (constant + d * linear + (d * d) * quadratic)

Note: constant, linear, and quadratic should always be set to values greater than 0.

Examples

Syntax

lightFalloff(constant, linear, quadratic)

Parameters

constant

constant value for calculating falloff.

linear

linear value for calculating falloff.

quadratic

quadratic value for calculating falloff.

Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/light.js and open a pull request!

Related References