Followers 0

## 2 posts in this topic

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 !

0

##### Share on other sites

Thank you, I'm reading it !

0

## Create an account

Register a new account