Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!lll-winken!sun-barr!newstop!exodus!nelsun.Eng.Sun.COM!srnelson From: srnelson@nelsun.Eng.Sun.COM (Scott R. Nelson) Newsgroups: comp.graphics Subject: Gamma correction (was: Radiosity Image Correction) Message-ID: <14070@exodus.Eng.Sun.COM> Date: 28 May 91 14:37:20 GMT References: <1991May27.135349.5072@vax5.cit.cornell.edu> Sender: news@exodus.Eng.Sun.COM Lines: 73 From article <1991May27.135349.5072@vax5.cit.cornell.edu>, by wuly@vax5.cit.cornell.edu: > With regard to the "too dark" radiosity results discussion: > > After talking with a grad student in computer graphics here at cornell: > (1) everybody using radiosity algorithms has this problem. > (2) a good way to assign colors to radiosity results is to do it > linearly, and then essentially gamma-correct the resulting image. > > I have found that gamma correction does wonders for me, and my images are > darker than most due to inaccurate (too low) energy transfers (it made > calculations very fast, though). For those of you using more accurate > routines, a gamma correction style transformation during color assignment > should be helpful. > > For my case, a gamma correction of 1.8 looks nice, but of course that depends > on the monitor and the image. When is the graphics community going to catch on to the need for gamma correction in ALL shaded images? Graphics calculations need to be performed in linear space to simulate the physical mixing of light. All CRT electron guns are nonlinear. You need to use gamma correction to map these linear intensity values in the frame buffer to the nonlinear values displayed on the CRT. Gamma correction does this. The broadcast television industry has settled on a standard gamma value of 2.222222 (1.0/0.45). This has been build into television sets for decades. This value happens to look correct on all properly adjusted monitors that I have seen. Also, since gamma correction is attempting to correct for the nonlinearity of the CRT electron guns, and since the three electron guns in a color CRT are of the same design, the gamma values for the three channels should be the same. If you are computing an image using radiosity, ray tracing, antialiased lines or even gouraud shading, you need to use a gamma corrected color lookup table to properly view your image. This has been posted before, but here is a C code fragment to print a gamma correction ramp for an 8-bit lookup table: /* * gamma.c * * Print a gamma correction table. * * cc -o gamma gamma.c -lm */ #include #define clut_gamma 2.222222 main() { int i; for (i = 0; i < 256; i++) { if (i % 16 == 0) printf("\n"); printf("%d: %d\n", i, (int) (255.0 * pow((double) i / 255.0, 1.0 / clut_gamma))); } } --- Scott R. Nelson srnelson@eng.sun.com Sun Microsystems "Proofread carefully to see if you any words out."