No, spherical harmonics are much simpler than that. They are simply functions mapped over a sphere. Just that.
The point is that these functions can be used to
represent complex physical phenomena using simple numbers.
WARNING...LONG ASS EXPLANATION AHEAD.
In the case we are dealing with, the physical phenomenom to be described is the irradiance of a given point.
The irradiance is the amount of light that comes to a certain point. And it is complex to sample every point in space, and keep a trace of all of them to transform all those sample in complex formulae. But it was found that this problem could be much easier if the irradiance was represented as the sumatory of these spherical harmonics functions.
Same as using a Fourier transform to recreate a sound wave, these functions can be used to recreate a function over a sphere. Hence their name "harmonic" and "spherical", and the irradiance is a function over a sphere in its definition.
There are many spherical harmonics functions. a constant, X, Y, Z, (X^2-Y^2),.... And they have what it is called "order". This "order" is the maximum exponent an spherical harmonic function has. A constant has order 0, X, Y and Z have order 1, or are of first order,( XX-YY) has order 2 or it is of second order, and so on, in the functions that are spherical harmonics. Not all functions are.
It was then found that with a sumatory of these functions and their respective coeficients up to the second order was enough to represent the irradiance at a given point with an average error below 3% over the original calculations. And these calculations only needed 9 coeficients, which corresponded to the spherical harmonics functions up to the second order.
Code: Select all
order 0: a Constant:
-----------------------
order 1: maximum exponent = 1
y:
z:
x:
-----------------------
order2: maximum exponent = 2
xy:
yz:
xz:
3zz-1:
xx-yy:
-----------------------
Giving values to these fuctions (the coeficients c1-c9), and adding up all of them gives us a polynomical function.
Code: Select all
c1 + c2y +c3z +c4x + c5(xy) + c6(yz) + c7(xz) +c8(3zz-1) + c9(xx-yy)
Giving values to X, Y and Z (a 3d
normalized vector) gives us the value of this function, which is that of the point in the "sphere" where that vector is pointing at.
Spherical harmonics are a form of representation, and can be seen as a vectorial space basis. The coeficients of these equations are 9-dimensional vectors.
Representing the incoming light in the form of SH becomes a matter of inverting the process. We have 9 coeficients to determine, and we have as input a vector and a light intensity.
Lets call the normalized vector XYZ and the intensity I.
Then, directly, without explanations...
Code: Select all
c1 = I
c2 = YI
c3 = ZI
c4 = XI
c5 = XYI
c6 = YZI
c7 = XZI
c8 = (3ZZ-1)I
c9 = (XX-YY)I
Then, also, in the problem we have at hand, apply another constants that were found so the problem mapped exactly to the irradiance. These constans are 5:
Code: Select all
k1=0.429043;
k2=0.511664;
k3=0.743125;
k4=0.886227;
k5=0.247708;
And the irradiance function becomes this.
Code: Select all
k4c1 + k2c2(y) + k2c3(z) + k2c4(x) + k1c5(xy) + k1c6(yz) + k1c7(xz) + k3c8(3zz-1) - k1c9(xx-yy) = I;
I hope this throws in a bit of knowledge of these odd 9-dimensional dudes...