Sign in to follow this  

Spherical Harmonics Cubemap

This topic is 831 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

I am working on generating a spherical harmonics irradiance environment map for diffuse lighting.  I've read various papers on the topic ([1], [2], [3], [4]), and I've set to work implementing the process as a set of compute shaders.  I'm struggling with getting the right result.

 

I've iterated over an input cubemap and generated 9 coefficients each for R, G, and B.  I have a function to evaluate the coefficients for a direction.  When generating the output cubemap, do I just store this evaluation at each texel, or do I store the evaluation multiplied by the corresponding texel read from the input cubemap?

Share this post


Link to post
Share on other sites

Then how do I apply the coefficients?  I thought section 3.2 of this paper was telling me how to get the irradiance using the coefficients in a matrix and the normal of the object being lit.  It made sense to me then to generate an irradiance environment cubemap that cached all the normal directions I might sample for.

Share this post


Link to post
Share on other sites

MJP, you are the man.  I had to change CosineA2 to be Pi * 0.25f, which corresponds with the 1, 2/3, 1/4 bands.  But it works!  I am digesting the paper you linked me to, and I still have to adjust for the high dynamic range of the cubemaps I'm testing with, as a lot of the stuff ends up over-exposed.  But it's definitely looking much better:

 

adoowGt.jpg

 

Thanks for your help!

Edited by Funkymunky

Share this post


Link to post
Share on other sites

This topic is 831 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.

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