In general, conversion of coefficients in one basis can be converted to another with a matrix multiplication of the sort that Peter-Pike showed in that paper.  Here is the general idea:

Assume you have a function f(x) represented in a basis b_i(x) with coefficients a_i:

f(x) = \sum_i a_i b_i(x)

And say you want to represent it in a new basis c_i(x) with coefficients d_i.  Assuming an orthonormal basis, etc, you project by integrating the function to be projected with the basis functions c_i(x):

d_i = \int c_i(x) f(x) dx

If you expand f(x) out, you get:

d_i = \int c_i(x) (\sum_j a_j b_j(x)) dx

You can interchange the integral and the sum and pull the constants a_j out of the integral:

d_i = \sum_j a_j \int c_i(x) b_j(x) dx

And voila, you can see that the integral can be precomputed given the pair of basis functions you care about and then represented as a matrix; this matrix times the a_j column vector gives the new coefficients d_i.

Hope this helps.  (And hope I didn't mess up the math at this early hour of the day.)

Matt Pharr

On May 20, 2008, at 12:03 AM, Rowan Wyborn (2K Australia) wrote:

The paper “Normal Mapping for Precomputed Radiance Transfer” ( contains a handy matrix to project 3rd order SH into the half life 2 basis. I was just wondering if anyone (or P.P.S if he’s still on this list J) had any insights into how this matrix is derived?
Additionally I wonder whether its possible to generalize this solution to an arbitrarily oriented set of basis vectors? Its not clear to me whether the results in this paper for the HL2 basis are achieved by:
a)      rotating the SH lighting into each vertex’s basis orientation and projecting using the given matrix
b)       by generating the projection matrix on the fly for each vertex’s basis orientation.
Anyone got any ideas?
This email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008.
GDAlgorithms-list mailing list