Class: SphericalHarmonicsRGB

SphericalHarmonicsRGB

SphericalHarmonicsRGB represents an L2 spherical harmonics approximation, storing 27 floats as an approximation for a low-frequency function on the unit sphere domain mapping to colour values.


new SphericalHarmonicsRGB()

Author:
  • derschmale <http://www.derschmale.com>

Methods


evaluate(vector [, target])

Evaluates the SH representation and returns the value at the given direction.

Parameters:
Name Type Argument Description
vector

The direction vector for which we're evaluating the function. This is expected to be normalized.

target Color <optional>

An optional target to store the evaluated value


setWeight(level, index, value)

Assigns the weight for a given SH basis function

Parameters:
Name Type Description
level

The SH level from 0 to 2

index

The index of the base function for the current level. For level 0, this must be 0. Otherwise it's in the range [-level, level]

value

A Float4 object containing the three weights in xyz.