Jump to content
  • Advertisement
Sign in to follow this  

Question about code in "Stupid Spherical Harmonics (SH) Tricks"

This topic is 2102 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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. 

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!