struct SphericalHarmonics

Spherical Harmonics are kinda like Fourier, but on a sphere. That doesn’t mean terribly much to me, and could be wrong, but check out here for more details about how Spherical Harmonics work in this context!

However, the more prctical thing is, SH can be a function that describes a value over the surface of a sphere! This is particularly useful for lighting, since you can basically store the lighting information for a space in this value! This is often used for lightmap data, or a light probe grid, but StereoKit just uses a single SH for the entire scene. It’s a gross oversimplification, but looks quite good, and is really fast! That’s extremely great when you’re trying to hit 60fps, or even 144fps.

Instance Fields and Properties

   
Vec3 coefficient1 A set of RGB coefficients
Vec3 coefficient2 A set of RGB coefficients
Vec3 coefficient3 A set of RGB coefficients
Vec3 coefficient4 A set of RGB coefficients
Vec3 coefficient5 A set of RGB coefficients
Vec3 coefficient6 A set of RGB coefficients
Vec3 coefficient7 A set of RGB coefficients
Vec3 coefficient8 A set of RGB coefficients
Vec3 coefficient9 A set of RGB coefficients
Vec3 DominantLightDirection Returns the dominant direction of the light represented by this spherical harmonics data. The direction value is normalized. You can get the color of the light in this direction by using the struct’s Sample method: light.Sample(-light.DominantLightDirection).

Instance Methods

   
SphericalHarmonics Creates a SphericalHarmonic from an array of coefficients. Useful for loading stored data!
Add Adds a ‘directional light’ to the lighting approximation. This can be used to bake a multiple light setup, or accumulate light from a field of points.
Brightness Scales all the SphericalHarmonic’s coefficients! This behaves as if you’re modifying the brightness of the lighting this object represents.
Sample Look up the color information in a particular direction!
ToArray Converts the SphericalHarmonic into an array of coefficients 9 long. Useful for storing calculated data!

Static Methods

   
FromLights Creates a SphericalHarmonics approximation of the irradiance given from a set of directional lights!




Found an issue with these docs, or have some additional questions? Create an Issue on Github!