首页 > 文档 > lightFalloff()光源衰减率
2017
08-02

lightFalloff()光源衰减率

Name lightFalloff()光源衰减率
ExampleslightFalloff()光源衰减率 - 第1张  | Processing编程艺术 lightFalloff()光源衰减率 - 第2张  | Processing编程艺术lightFalloff()光源衰减率 - 第3张  | Processing编程艺术

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.

设置点光源、聚光灯和环境灯的衰减率。与填充 () 一样, 它只影响在代码中创建的元素。默认值为 lightFalloff (1.00.00.0), 参数用于用以下公式计算衰减:

d = 从光位置到顶点位置的距离

衰减 = 1/(常数 + d * 线性 + (d * d) * 二次)

考虑一个有衰减的环境光线可能会很棘手。如果你希望你的场景的一个区域被点亮 ambiently, 用一种颜色, 另一个区域用另一种颜色点亮 ambiently, 你可以使用环境光来定位和衰减。你可以把它看作一个点光源, 它不关心表面朝向的方向。

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()


最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。