Gamma Correction for Celestia

The place to discuss creating, porting and modifying Celestia's source code.

Do you think this should be posted here or in Celestia Bugs?

Poll ended at 15.06.2004, 23:56

Here
1
100%
Celestia Bugs
0
No votes
Somewhere Else
0
No votes
 
Total votes: 1

Topic author
maaf
Posts: 21
Joined: 07.07.2003
With us: 21 years 4 months
Location: Brazil

Gamma Correction for Celestia

Post #1by maaf » 16.05.2004, 23:56

Have any Celestia developer minded about gamma setting in computer systems? In Celestia 1.3.1 it seems that gamma setting was an overlooked subject, since the rendering of planet Earth looks too dark.
I have a link to a page that explains very well about gamma correction in CRTs and desktop computers:

http://www.cgsd.com/papers/gamma_intro.html

Briefly explaining, the output of a monitor (in brightness) is approximately a power of the voltage applied to the R,G,B pins:

L = V^gamma

The "gamma" factor is the power in the above equation.
E.g., for a monitor that has a gamma of 2.5, if you apply the half of the voltage for color white, you will get on your screen (0.5)^2.5 = 0.177 the brightness of "white".
But the video adapter may apply a partial gamma correction, thus effectively changing the gamma factor of a computer system. This new gamma factor is know as "system gamma".
If you output RGB=(0x80,0x80,0x80) in a computer with system gamma of "1.8" you will get on the screen 0.287 times the brightness of "white".


The great thing about this is that the non-linear response of the monitor greatly increases the dynamic range of the monitor. E.g, for a computer+monitor with a system gamma of 2.0 is possible to simultaneously plot Pluto and Earth with their true relative brightness in the same picture.

Assuming level 255 (0xFF) for the cloud tops of Earth (albedo = aprox. 100%), an albedo of 80% for Pluto, 35% for Earth and Pluto at 39 AU from Sun, and a system gamma of 2.0, the Earth would be plotted with color level 151 (0x97), and Pluto with color level 6 (0x06). (I didn't post the math here to not increase this post size too much).

I did some tests by my own and I found that the system gamma for a friend of mine computer system's is roughly 2.0. To do this test you will need a photometer. I've built a simple one with a photodiode, a digital multimeter and a DC source (eg. a battery with a limiting resistor in series). This is so simple that anybody that has a digital multimeter can do. (I'll send a schematic of this if anybody shows interest).

I'm unsure if this post should be posted here or in Celestia Bugs.

granthutchison
Developer
Posts: 1863
Joined: 21.11.2002
With us: 22 years

Post #2by granthutchison » 17.05.2004, 12:12

See FAQ 16 for the reason we haven't devoted time to achieving "realistic" brightness ratios.

Grant

Spaceman Spiff
Posts: 420
Joined: 21.02.2002
With us: 22 years 9 months
Location: Darmstadt, Germany.

Post #3by Spaceman Spiff » 17.05.2004, 19:12

I'm reminded of this recent thread: High dynamic range rendering (http://www.celestiaproject.net/forum/viewtopic.php?t=4784). This could answer about how to handle 'gamma'. The FAQ16 answer is in a way correct because our eyes' dynamic range lets almost any light level across a solar system be adjusted to quite a constant level. This assumption doesn't work with some distant but telescopic view of say Earth and Pluto together - Pluto should have much fainter surface brightness, as you say maaf. People can check out photos of Jupiter or Saturn being occulted by the moon to see the relative dimness of those planets.

Otherwise, we've been getting away with it because Celestia has been restricted to single light source models. The real problem starts when including binary star systems because a primary can be so much brighter than a secondary. This is where the high dynamic range stuff should save the day. As well as the usual auto-exposure, I hope people can adjust that level to show either the primary or secondary at a 'correct' exposure level. I expect the graphics drivers will provide that. I'd be quite happy to wait for binary stars to come out with the high dynamic range graphics.

In the meantime, since the CGSD articles referred to point out that different monitor gammas between Macs and PCs leads to the problem of overbright or dull images, also that the PNG format is supposed to state the gamma level to get round this problem, then maybe people should try and 'standardise' to PNGs. Bear in mind that maybe the 'standard' textures in the distribution are dark to begin with because they've been adjusted for maximum saturation. I often up the brightness of planet surface textures with a 'gamma correction' anyway - dark navy blue for the sea as in Blue Marble just doesn't seem right to me. Perhaps three functionalities could be added to Celestia in the meantime:
1. there could be a texture gamma, a parameter for each texture in the .scc files to allow it to be brightened or dimmed to an aesthetically pleasing level,
2. there could be a light-source gamma which could be calculated by Celestia to take account of distance from light source.
3. there could be a master gamma, which lets you brighten everything (like max star magnitude, but note that just adds fainter stars, it doesn't brighten them). I think someone proposed this a long time ago. Maybe it didn't happen because you can't gamma correct textures after they're loaded. Perhaps in a config file at startup, then?
4. for the true fan, there could be a monitor gamma that you measure and enter into Celestia yourself! Aren't there games utilities for adjusting monitor settings so that people over the internet see all textures at the same levels?

I don't think this issue is a bug, I think it's a feature. Would the high dynamic range 'future' solve this, maaf?

Spiff.

Topic author
maaf
Posts: 21
Joined: 07.07.2003
With us: 21 years 4 months
Location: Brazil

Post #4by maaf » 19.05.2004, 01:52

Thanks.

Perhaps I had this problem with earth being too dark because my hardware is too old to recognise gamma setting in PNG, or because I didn't configured Celestia gamma setting (if this feature is available.), etc.

Here's my system:
Celeron 433MHz 96Mb RAM
On board video adapter (ASUS motherboard)

Software:
Celestia 1.3.1 (default package)
Windows 98 SE (Portuguese edition)

Until next time.


Return to “Development”