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 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. 设置点光源、聚光灯和环境灯的衰减率。与填充 () 一样, 它只影响在代码中创建的元素。默认值为 lightFalloff (1.0、0.0、0.0), 参数用于用以下公式计算衰减: d = 从光位置到顶点位置的距离 衰减 = 1/(常数 + d * 线性 + (d * d) * 二次) 考虑一个有衰减的环境光线可能会很棘手。如果你希望你的场景的一个区域被点亮 ambiently, 用一种颜色, 另一个区域用另一种颜色点亮 ambiently, 你可以使用环境光来定位和衰减。你可以把它看作一个点光源, 它不关心表面朝向的方向。 |
||||||
Syntax | lightFalloff(constant, linear, quadratic) | ||||||
Parameters |
|
||||||
Returns | void | ||||||
Related | lights() ambientLight() pointLight() spotLight() lightSpecular() |
- 本文固定链接: http://iprocessing.cn/2017/08/02/lightfalloff光源衰减率/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表