Question about Irradiance Environment Maps

Started by
2 comments, last by MJP 10 years, 9 months ago

Hello All,

I've been reading about using spherical harmonics to create irradiance environment maps and I want to give it a shot. However, one question I have, which I can't seem to find an answer from in the resources I'm reading is how the original cube map is formed. So obviously in a static scene, you can just load a cube cross from disk, and viola. But, for real time rendering, you are going to need to regenerate this environment map on every single frame, theoretically. So the way I see it, this is my rendering batches:

  1. Render the current environment 6 times, one for each cube face, render to a texture
  2. Compute my irradiance environment cubemap, send it to the video card
  3. Render the environment again, this time from the POV of the camera
  4. Render all of my objects with my irradiance map

Now maybe I'm underestimating my GPU, but this seems like a lot of processing. It seems nearly impossible that I'm going to be able to do all of this in 16ms and still have time to spare to update the rest of my game world. Is there something I'm missing here, or is this generally the strategy used for real time irradiance environment maps?

Advertisement

Usually, you don't do this in realtime because it is expensive ;) Many games will pre-generate hundreds of these irradiance "probes" and store them on disc, which works fine as long as your level geometry is mostly static and you don't mind dynamic objects not contributing to your GI.

If you do want to generate them at runtime, you can do step #2 on the GPU instead of downloading the texture to the CPU and then sending the results back to the GPU.

Also, you usually wouldn't want to use just one irradiance map for your whole scene -- you'd want one every few meters, or one per object, etc, etc

I think it's a good idea in general to do step #2 on the GPU, even for pre-computation.

Indeed, it's fairly rare for games to render environment maps at runtime. Usually it's only racing games that do it.

An irradiance environment map stored as 2nd-order SH with 16-bit floats is 54 bytes, so you can potentially store a whole lot of those in a scene.

This topic is closed to new replies.

Advertisement