Sign in to follow this  

[solved]Irradiance cube map rendering

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

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