Topics

Friday, November 25, 2011

Gamma Terminated

Let's talk about terminators and gamma. No, not the human-killing robots from the future, but the line dividing light and shadow on a lit object. And not the gamma radiation that turned a scientist into an angry green giant, but the non-linear behavior of our eyes and optical devices to light intensity. Finally, we'll take a look at how the Earth's terminator is unique from, say, the Moon's terminator.

This article from GPU Gems 3 explains gamma correction and the importance of linearity when creating rendered images. Basically, our eyes, cameras and display devices all do not respond to light in a linear fashion. Our eyes are more sensitive in low-light conditions and can see more variations in intensity than in very bright environments. Similarly, the brightness output of a display device does not respond in a linear fashion to the voltage input, being dimmer at the lower intensity ranges than the correct output should be. Because every device has a different gamma response, the same input image may appear very different on different display devices.

Hence, gamma correction has been introduced to ensure that what we see on our typical display (e.g. LCD monitor) looks visually correct compared to what we would see using our naked eye. This blog article from Beautiful Pixels (where the following image originates) offers a good example of what a gamma corrected render should look like:

From left: uncorrected CG sphere, photo of half Moon, gamma corrected CG sphere
For a solid diffuse surface, the natural appearance would be to have a clearly delineated terminator where the transition from light to dark is well defined.

Viewed from space, the Earth's terminator should also be well defined, as confirmed by photos of the Earth taken from spacecrafts and Apollo astronauts. So then, what's so special about the Earth's terminator?

When light is shone onto a sphere, the terminator line would divide the sphere into exactly two halves - half in the light and the other half in darkness. However, in the case of the Earth, the sunlit portion is actually greater than the night portion. This can be observed as during the equinoxes, there are more than 12 hours of daylight in a 24 hour day. How is that so?

The answer is the Earth's atmosphere. It actually bends light by about half a degree (60km) into the area of the Earth that would otherwise be dark. Also, the atmosphere scatters light across the sky so the ground would not be in total darkness even after the Sun has set.

You can check out which parts of the Earth is currently in day and night here. After looking at the pretty picture, do read the notes for some very good explanations. You can map the picture onto a 3D sphere and confirm for yourself that the terminator line slightly over the halfway mark.

The following is my attempt to capture this effect by modifying the illumination equation in shaders (image dated 7 Oct 2011):






No comments:

Post a Comment