参考 lightFalloff()

lightFalloff()

设置 pointLight()spotLight() 的衰减率。

光的衰减描述了其在距离上的光束强度。例如,一个灯笼具有缓慢的衰减,手电筒具有中等的衰减,激光笔具有迅速的衰减。

lightFalloff() 有三个参数, constantlinearquadratic。它们是用于计算距离 d<code> &#x7684;&#x8870;&#x51cf;&#x7684;&#x6570;&#x5b57;&#xff0c;&#x5982;&#x4e0b;&#x6240;&#x793a;&#xff1a;</code>

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

注意: constant, linearquadratic 应始终设置为大于 0 的值。

示例

语法

lightFalloff(constant, linear, quadratic)

参数

constant
数字:

用于计算衰减的常数值。

linear
数字:

用于计算衰减的线性值。

quadratic
数字:

用于计算衰减的二次值。

This page is generated from the comments in src/webgl/light.js . Please feel free to edit it and submit a pull request!

相关参考