sh3_sample_by_direction
sh3_sample_by_direction(result, result_offset, harmonics, harmonics_offset, dimension_count, direction, direction_offset)
Sample value from a 3-band spherical harmonic defined by 9 coefficients
Kind: global function
See
- https://github.com/mrdoob/three.js/blob/d081c5a3501d272d19375fab1b01fedf9df29b22/src/math/SphericalHarmonics3.js#L55
- https://graphics.stanford.edu/papers/envmap/envmap.pdf
- https://www.ppsloan.org/publications/StupidSH36.pdf
Param | Type | Description |
---|---|---|
result | Array.<number> | Result will be written here |
result_offset | number | |
harmonics | Array.<number> | coefficients are read from here |
harmonics_offset | number | offset into coefficients array where to start reading the data |
dimension_count | number | number of encoded dimensions, this is essentially a shortcut for multiple harmonics being read at the same time, such as with RGB values |
direction | Array.<number> | 3d vector read from here, we will read 3 values from here to sample spherical harmonic, direction is assumed to be normalized |
direction_offset | number | offset into direction array |