Capítulo 774 de 859

Chapter 774: SphericalHarmonics3

Core Idea

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

Key Concepts

  • coefficients : Array.<Vector3>: An array holding the (9) SH coefficients.
  • isSphericalHarmonics3 : boolean (readonly): This flag can be used for type testing.

Reference Tables

Constructor

Signature
new SphericalHarmonics3()

Properties

PropertyDescription
.coefficients : Array.<Vector3>An array holding the (9) SH coefficients.
.isSphericalHarmonics3 : boolean (readonly)This flag can be used for type testing.

Methods

MethodDescription
.add( sh : SphericalHarmonics3 ) : SphericalHarmonics3Adds the given SH to this instance.
.addScaledSH( sh : SphericalHarmonics3, s : number ) : SphericalHarmonics3A convenience method for performing SphericalHarmonics3#add and SphericalHarmonics3#scale at once.
.clone() : SphericalHarmonics3Returns a new spherical harmonics with copied values from this instance.
.copy( sh : SphericalHarmonics3 ) : SphericalHarmonics3Copies the values of the given spherical harmonics to this instance.
.equals( sh : SphericalHarmonics3 ) : booleanReturns true if this spherical harmonics is equal with the given one.
.fromArray( array : Array.<number>, offset : number ) : SphericalHarmonics3Sets the SH coefficients of this instance from the given array.
.getAt( normal : Vector3, target : Vector3 ) : Vector3Returns the radiance in the direction of the given normal.
.getIrradianceAt( normal : Vector3, target : Vector3 ) : Vector3Returns the irradiance (radiance convolved with cosine lobe) in the direction of the given normal.
.lerp( sh : SphericalHarmonics3, alpha : number ) : SphericalHarmonics3Linear interpolates between the given SH and this instance by the given alpha factor.
.scale( s : number ) : SphericalHarmonics3Scales this SH by the given scale factor.
.set( coefficients : Array.<Vector3> ) : SphericalHarmonics3Sets the given SH coefficients to this instance by copying the values.
.toArray( array : Array.<number>, offset : number ) : Array.<number>Returns an array with the SH coefficients, or copies them into the provided array. The coefficients are represented as numbers.
.zero() : SphericalHarmonics3Sets all SH coefficients to 0.

Key Takeaways

  1. Most relevant properties: coefficients, isSphericalHarmonics3.
  2. Key methods: add, addScaledSH, clone, copy.

Connects To