I really like idea of light pre-pass approach (credits to Wolfgang Engel here), but there is still one drawback - it's difficult to implement significantly different shading models.
Recently I was playing with SH-based lighting, and suddenly one idea has struck me :) It is theoretically possible to accumulate irradiance into SH in screen space using only depth-buffer, then render scene with this information. Of course, implementing this straightforward is just sick, as it would require at least 4x3 channels per pixel for linear SH only, not to mention quadratic SH needing 9x3 channels per pixel. On the other hand, there are some optimizations possible. A few that immediately come to mind:
1) Store color for 0-th band only, this will drastically reduce space needed to 3+3 or 3+8 channels, and there is some hope that subjective quality won't be too bad since human eye is much more sensitive to intensity than to color
2) If we forget about shadows for a while, irradiance is quite a low frequency function, so it might be possible to store it at lower resolution, and still get nice per-pixel bump-mapped details. That way framebuffer memory requirements could be lowered by a factor of 4x-16x or even more. This can be used to increase SH order or to store more color information. Another possibility is to store irradiance for different depths so that we can handle transparency in the same rendering path.
3) Considering shadows - this needs experimentation, but I still believe that it would be sufficient to have 1 irradiance sample per 2x2 pixel block for a good quality, or 4x4 block for average quality. Furthermore, shadow filtering becomes much cheaper since we are already working at lower resolutions.
I'm considering trying to implement this in near future, unless people at gamedev.net forums tell this is way too mad :)
P.S. One more thought - using second very low resolution screen space ambient irradiance map (something like 8x6, maybe 2 or 4 layers) it might be possible to regenerate it in real time, achieving realtime global illumination :)
Sunday, January 4, 2009
Subscribe to:
Comments (Atom)