The Stupid Spherical Harmonics (SH) Tricks article contains several code snippets and one is about irradiance environment maps.
The code is split in a CPU and a GPU part. And I am a bit confused about what happens where.
I interpret it the way, that the SH coefficients are pre-processed before placing them in shader constants so that the code on the GPU can be somewhat simpler. Is that correct?
AFAIK you can interpolate two sets of SH coefficients to get a blended result. Is this still possible with the "processed" SH that are used by this shader code? Or would the interpolation have to be done beforehand?
Microsoft provides a small API that can project a cube map into spherical harmonics. I found the code really helpful but unfortunately I couldn't find any concise information about how to "sample" the SH coefficients with a direction vector.