• Advertisement
Sign in to follow this  

[solved]Irradiance cube map rendering

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

[EDIT]Nevermind, I've found the answer by reading one more time the linked paper.

 

 

Hi Gamedev,
 
I'm currently implementing ambient lighting using spherical harmonics, inspired by this paper, and I'm looking for some details.
Basically, I don't understand how they do the real time relighting stuff described in slides 7 to 10

Right now I'm rendering a bunch of environment cube maps with my scene rendered with only the textures color, no lighting at all.
 
Then I compute the spherical harmonics for the cube maps, and the final lighting shader looks like this:


//final lighting code
float4 finalColor = irradiance*texture + NDotL * shadows * texture;

This gives nice results but I don't think this is the right way to do it, and I should render my scene with full shadowing, using something like:


//cubemap render code
float4 color = NDotL * shadows * texture;

Which seems to be a better way, as lit zones will "generate" more irradiance than unlit ones.
And then change the final lighting equation to something like that:


//final lighting code
float4 finalColor = texture+irradiance+NDotL * shadows * texture;

 
But this bothers me because if the light direction changes, I need to recompute all the cube maps, which is not "real time friendly".
So what am I missing ?
 
Thank you very much for any help !

Share this post


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

  • Advertisement