[solved]Irradiance cube map rendering

Started by
1 comment, last by PLCrashy 10 years ago

[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 !

Advertisement

Here Hodgman provided an explanation of Far Cry's algorithm that you might find useful: http://www.gamedev.net/topic/649604-what-on-earth-is-far-cry-3s-deferred-radiance-transfer/

“We should forget about small efficiencies, say about 97% of the time; premature optimization is the root of all evil” - Donald E. Knuth, Structured Programming with go to Statements

"First you learn the value of abstraction, then you learn the cost of abstraction, then you're ready to engineer" - Ken Beck, Twitter

Thank you, I'm reading it !

This topic is closed to new replies.

Advertisement