Jump to content
  • Advertisement
Sign in to follow this  
jjtulip

Irradiance Filtering with SH

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

Hi!

 

I'm trying to include in my code something like is done here: http://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/ for the irradiance map computation.

Now although my code is a bit different, it strongly resemble what is in the post I linked before. Or at least I think so. 

The problem is that for the cubemap that is there as reference:

 

osuIkWZ.png

 

 

I obtain this result which is both different from the one in the site and also doesn't have the reddish hue that I was expecting: 

 

vqgghgX.png

 

 

I can post the code but is quite a lot. Is there evident what can be wrong? 

 

What I'm doing is:

 

For each face

   for each u,v 

        Compute direction vector for (u,v)

        Get solid angle

        Compute SH terms using  the "Y"s found on Stupid SH Tricks  (

        Use these to project the above said vector in SH     

                            for each u,v 
                                 ....
                               SHTerms = getSHTerms(...);
                               for(int i=0; i<SHTerms.size(); i++){
					projected.at(i) += RGB * SHTerms.at(i) * solidAngle;
				}

        Normalize each of these projected multiplying by 4*pi/sumSolidAngles

Then, with these projected values I get back to the env map using a formula like  projectedValue * SHTerm(i) * band(i) where i loops through the number of SH terms (the "Ys" ) 

 

 

These values are written back to the various cube faces and the result is the one posted above. 

 

 

What can be wrong? Thank you very much. 

Share this post


Link to post
Share on other sites
Advertisement

Are you using a Hdr version of that cubemap? The filter doesn't work with tonemapped data.

 

No, I'm not using an HDR cubemap, but why it doesn't work? The AMD tool doesn't seem to make such limitations

Edited by jjtulip

Share this post


Link to post
Share on other sites

Your irradiance calculation is a convolution with a cosine kernel over an entire hemisphere, and it essentially acts a low-pass filtering. So it's not unusual to "blur away" a lot of your details. With an HDR source it's possibly to have portions that are many many times brighter than other parts of the cubemap, which allows for certain features to come through more strongly in the filtered result. You should definitely try with an HDR source and see if you get results more inline with what you expect. 

Share this post


Link to post
Share on other sites

Your irradiance calculation is a convolution with a cosine kernel over an entire hemisphere, and it essentially acts a low-pass filtering. So it's not unusual to "blur away" a lot of your details. With an HDR source it's possibly to have portions that are many many times brighter than other parts of the cubemap, which allows for certain features to come through more strongly in the filtered result. You should definitely try with an HDR source and see if you get results more inline with what you expect. 

 

Thanks! 

Well I tried with an hdr version of the same cubemap the result mantains the reddish hue, but my result is still very different from the one produced with the cubemapgen tool 

 

87TYWaS.png

 

Whereas the one presented in the above article is:

 

skybeamshorder5filter.png

 

Now, the screenshot of my result has been taked from gDebugger so maybe the tonemapping is different (hence the texture is more dark, right?), but still the "shape" of the image is quite different

Edited by jjtulip

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!