Skip to content

Documentation / base / SH

Class: SH

Defined in: libs/base/src/math/sh.ts:8

Spherical harmonics utilities

Constructors

Constructor

new SH(): SH

Returns

SH

Properties

MIN_ORDER

readonly static MIN_ORDER: 2 = 2

Defined in: libs/base/src/math/sh.ts:10

Minimum supported harmonics order


MAX_ORDER

readonly static MAX_ORDER: 3 = 3

Defined in: libs/base/src/math/sh.ts:12

Maximum supported harmonics order

Methods

evalBasis()

static evalBasis(direction, order): number[]

Defined in: libs/base/src/math/sh.ts:21

Evaluate SH basis for specific order

Parameters

direction

Vector3

Direction to evaluate, must be normalized

order

number

SH order

Returns

number[]

The SH basis evaluate at given direction


evalDirectionLight()

static evalDirectionLight(direction, color, order): Vector3[]

Defined in: libs/base/src/math/sh.ts:62

Evaluates a directional light and returns spectral SH data

Parameters

direction

Vector3

Direction of the light

color

Vector3

Light color

order

number

SH order

Returns

Vector3[]

Evaluated SH data

Released under the MIT License.