Friday, August 15, 2008

Post Mortem: Advances in Real-Time Rendering Part 1

Global Illumination

The discussion about global illumination was headed by Hao Chen, lead graphics software architect at Bungie.

The idea of using global illumination in real-time applications has become a very important concept in new games.  If the surface does not emit any light (emissive) the formula used to calculate global illumination is listed.

globalillumination



This formula assumes a BRDF (f) has already been calculated.  This presented the Halo3 engineers with 2 challenges.  The first was that while this formula can be solved for a small amount of simple lights (point lights for instance), it is not feasible to solve in real-time as would be needed by the engine.  The second is driven by the fact that Halo contains many different types of surfaces (shiny, dull, etc).  The Phong BRDF model has been used in interactive, real-time environments but again this was only with a small number of point lights.  Also, the engineers did not feel that the Phong model would capture the detail they were looking for.


So the approach taken was to rely on the CookTorrance BRDF model.  The system created could rely on other models, if others were found to be more accurate.


cooktorrance


So the final rendering equation would then be:


final


There is yet another problem.  The diffuse and specular in the above listed equation involve an integral that is quite expensive to calculate.  If the lights were simple point lights this would probably not be an issue, but as we are using a different type of light source it cannot be used as above.  So the team turned to SH (spherical harmonics).


Specifically, there are 2 cases (diffuse and specular lights).  For diffuse lighting there are shadowed and unshadowed cases that need to be calculated.  Unshadowed diffuse can be calculated in the shader using a quadratic polynomial approximation.  Shadowed diffuse can use pre-computed radiance transfer method result combined (as a dot product) with the incoming light.  There is still one remaining issue to calculate accurate diffuse lighting.  The equation encodes the incident radiance as a single point.  This is not accurate when using to light an entire scene.  Usually, to solve this various random samples are chosen and interpolation used to fill in the rest.  This will give ok results on small areas but not on big scenes.  The other strategy, and one chose here, is to build light maps and grid the scene (and add sample points per cell).  In Halo3, the choice was made to use a photon mapper to "bake" the incident radiance into these light maps.  This is an offline process.


The specular reflectance was much harder to calculate.  The problem is glossy surfaces contain a full range of frequencies.  The choice was made here to break this down to 3 frequencies (low, mid, high).  The high is calculated in the shader (BRDF), the middle frequencies are handled by cube maps, and lows are handled by BRDF again (which is parameterized).


 


REFERENCES:


[BASRIJACOBS03] BASRI, R., AND JACOBS, D. W. 2003. Lambertian reflectance and
linear subspaces. IEEE Trans. Pattern Anal. Mach. Intell. 25, 2, pp. 218–
233.
[BLINN77] BLINN, J. F. 1977. Models of light reflection for computer synthesized
pictures. ACM SIGGRAPH Comput. Graph. 11, 2, pp. 192–198.
[CHEN08] CHEN, H. Lighting and materials of Halo 3. Game Developers
Conference, 2008.
[COOKTORRANCE81] COOK, R. L., AND TORRANCE, K. E. 1981. A reflectance model
for computer graphics. In Proceedings of ACM SIGGRAPH 1981, pp. 307–
316. [GOODTAYLOR05] GOOD, O., AND TAYLOR, Z. 2005. Optimized photon tracing using
spherical harmonic light maps. In Proceedings of ACM SIGGRAPH 2005,
Technical Sketches, p. 53.
[GSHG98] GREGER, G., SHIRLEY, P., HUBBARD, P. M., AND GREENBERG, D. P. 1998.
The irradiance volume. IEEE Comput. Graph. Appl. 18, 2, pp. 32–43.
[HUWANG08] HU, Y., AND WANG, X. Lightmap compression in Halo 3. Game
Developers Conference, 2008.
[ICG86] IMMEL, D. S., COHEN, M. F., AND GREENBERG, D. P. 1986. A radiosity
method for non-diffuse environments. ACM SIGGRAPH Comput. Graph.
20, 4, pp. 133–142.
[KAJIYA86] KAJIYA, J. T. 1986. The rendering equation. In Proceedings of ACM
SIGGRAPH 1986, pp. 143–150.
[KSS02] KAUTZ, J., SLOAN, P.-P., AND SNYDER, J. 2002. Fast, arbitrary brdf shading
for low-frequency lighting using spherical harmonics. In Proceedings of the
13th Eurographics workshop on Rendering 2002, pp. 291–296.
[NDM05] NGAN, A., DURAND, F., AND MATUSIK, W. 2005. Experimental analysis of
brdf models. In Proceedings of the Eurographics Symposium on Rendering
2005, pp. 117–226.
[OAT05] OAT, C. Irradiance Volumes for Games, Game Developers Conference,
2005. http://ati.amd.com/developer/gdc/GDC2005_PracticalPRT.pdf
[PSS99] PREETHAM, A.J., SHIRLEY, P. AND SMITS, B. 1999. A Practical Analytic
Model for Daylight, In Proceedings of Siggraph 1999, pp. 91 – 100, Los
Angeles, CA.
[RAMAMOORTHIHANRAHAN01] RAMAMOORTHI, R., AND HANRAHAN, P. 2001. An efficient
representation for irradiance environment maps. In Proceedings of ACM
SIGGRAPH 2001, pp. 497–500.
[RAMAMOORTHIHANRAHAN01B] RAMAMOORTHI, R., AND HANRAHAN, P. 2001. On the
relationship between radiance and irradiance: Determining the illumination
from images of a convex Lambertian object. Journal of the Optical Society
of America, Vol. 18, 10, pp. 2448–2459. [RAMAMOORTHIHANRAHAN02] RAMAMOORTHI, R., AND HANRAHAN, P. 2002. Frequency
space environment map rendering. In Proceedings of ACM SIGGRAPH
2002, 517–526.
[SCHLICK94] SCHLICK, C. 1994. An inexpensive BRDF model for physically-based
rendering. Computer Graphics Forums. 13, (3), 233–246.
[SLOANSNYDER02] SLOAN, P.-P., KAUTZ, J., AND SNYDER, J. 2002. Precomputed
radiance transfer for real-time rendering in dynamic, low frequency lighting
environments. ACM Trans. Graph. 21, 3, 527–536.
[SHHS03] SLOAN, P.-P., HALL, J., HART, J., AND SNYDER, J. 2003. Clustered
principal components for precomputed radiance transfer. ACM Trans.
Graph. 22, 3, 382–391.
[VILLEGASSEAN08] VILLEGAS, L., AND SEAN S. Life on the Bungie Farm: Fun Things
to Do with 180 Servers . Game Developers Conference, 2008.

2 comments:

HZ King said...

Nice blog you've got.
If the date you put on Biohazard-Software is correct then it's your 33rd so congrats to you and have a happy programming party or something :)

-HZ King
Biohazard-Software community admin

Cale Teeter said...

Thanks!