Sign in to follow this  

The use of spherical harmonics

Recommended Posts

The array of spherical harmonic coefficients (that you now presumably have) can be thought of as a discrete cosine transform results of the lighting signal, where the spatial parameter space is a sphere.


To reconstruct the approximation of the signal (the light strength), you basically sum the cosines of the coefficients together, using the frequency multipliers and weights that you used to calculate the coefficients. This integration operation closely resembles the process with which you obtain said coefficients. The forward and inverse operations on SH:s are extremely similar to those in DCT and FFT, for example.


Note that you should have three sets of sh coefficients; one for each channel in RGB. The summation is relatively simple if you perform the sh calculation on the RGB signal so that you get an array of float3's (for RGB triplets) as a result; this is because in HLSL or GLSL, you can directly obtain both the cosine and the sum of 1 to 4-element vector primitives.

Edited by Nik02

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this