返回介绍

手册

参考

示例

开发者参考

SphericalHarmonics3

发布于 2021-07-10 14:14:18 字数 4339 浏览 1067 评论 0 收藏 0

Represents a third-order spherical harmonics (SH). Light probes use this class to encode lighting information.

Constructor

SphericalHarmonics3()

Creates a new instance of SphericalHarmonics3.

Properties

.coefficients : Array

An array holding the (9) SH coefficients. A single coefficient is represented as an instance of Vector3.

Methods

.add ( sh : SphericalHarmonics3 ) : SphericalHarmonics3

sh - The SH to add.

Adds the given SH to this instance.

.addScaledSH ( sh : SphericalHarmonics3, scale : Number ) : SphericalHarmonics3

sh - The SH to add.
scale - The scale factor.

A convenience method for performing .add() and .scale() at once.

.clone () : SphericalHarmonics3

Returns a new instance of SphericalHarmonics3 with equal coefficients.

.copy ( sh : SphericalHarmonics3 ) : SphericalHarmonics3

sh - The SH to copy.

Copies the given SH to this instance.

.equals ( sh : SphericalHarmonics3 ) : Boolean

sh - The SH to compare with.

Returns true if the given SH and this instance have equal coefficients.

.fromArray ( array : Array, offset : Number ) : SphericalHarmonics3

array - The array holding the numbers of the SH coefficients.
offset - (optional) The array offset.

Sets the coefficients of this instance from the given array.

.getAt ( normal : Vector3, target : Vector3 ) : Vector3

normal - The normal vector (assumed to be unit length).
target - The result vector.

Returns the radiance in the direction of the given normal.

.getIrradianceAt ( normal : Vector3, target : Vector3 ) : Vector3

normal - The normal vector (assumed to be unit length).
target - The result vector.

Returns the irradiance (radiance convolved with cosine lobe) in the direction of the given normal.

.lerp ( sh : SphericalHarmonics3, alpha : Number ) : SphericalHarmonics3

sh - The SH to interpolate with.
alpha - The alpha factor.

Linear interpolates between the given SH and this instance by the given alpha factor.

.scale ( scale : Number ) : SphericalHarmonics3

sh - The scale factor.

Scales this SH by the given scale factor.

.set ( coefficients : Array ) : SphericalHarmonics3

coefficients - An array of SH coefficients.

Sets the given SH coefficients to this instance.

.toArray ( array : Array, offset : Number ) : Array

array - (optional) The target array.
offset - (optional) The array offset.

Returns an array with the coefficients, or copies them into the provided array. The coefficients are represented as numbers.

.zero () : SphericalHarmonics3

Sets all SH coefficients to 0.

Static Methods

.getBasisAt ( normal : Vector3, shBasis : Array ) : void

normal - The normal vector (assumed to be unit length).
shBasis - The resulting SH basis.

Computes the SH basis for the given normal vector.

Source

src/math/SphericalHarmonics3.js

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文