What does the world look like?
Well, some parts of the world are very dark; caves, coal, under the bed during the night.
Some parts of the world are not so dark; evening time, sand, peoples' faces. Some parts are bright; a white suit, snow, sails, lightbulbs. Some things in the world are very bright indeed; spotlights, the sky, the sun, and lasers.
What do computer graphics look like?
Images displayed on a computer have a range of brightnesses, usually 256, ranging from 0 (a dark grey) to 255, a dim white.
Lets ask another question:
With this in mind, how can we ever hope to produce realistic images of the natural world on a computer screen? The natural world has such a large range of brightnesses, but a computer screen can only display a very narrow range of them. You might try to scale the range of brightnesses in the natural world down to fit, say take a dark cave to be brightness 0, and the sun 255 bright. If you do this, you will have serious trouble representing images of, say, peoples' faces. They will appear very dark. The brightness of the image on the right has been scaled so that the sun is brightness 255. You can see the sun very well thankyou, but the sky looks a bit dark, and it looks like night time on the land.
Another option would be to clip the values. Say, anything brighter than snow will be be displayed with brightness 255.
On the right, you can see such an image. Now the land looks fine, but the sky, which is very much brighter than the land, has become almost totally white. You can no longer see the sun, and the clouds are just white forms on a light blue background.
What do photographs look like?
Like a computer screen, photographs have a narrow range of brightnesses. The darkest thing on a photograph is not quite
black, and the lightest part of a photo is no brighter than the environment it's being viewed in.
So, how is it that photographs don't seem to suffer from the same problems? Well, they do in fact, but they are much
better at handling a large range of intensities. They also have exposure control. To understand why this is, it will help
to see how a photograph is made.
Taking a Photograph
When a photo is taken, the shutter in the camera opens for a fraction of a second to allow light from the scene to
enter. The light is focused by the camera lens onto a piece of light sensitive film. The film contains chemicals which
break down when exposed to light and thus the image is recorded on the film by the pattern of chemicals, broken down or otherwise.
The more the chemicals are broken down, the brighter the resulting photo will be
The amount of light that enters the lens can be controled by the length of time the camera shutter is open for (the exposure), and the width of the aperture (the fstop).
Later, the film is developed to stop it being light sensitive and bring out the colours. This is the negative. Then light is shone through it onto another piece of photographic paper which becomes the photograph.
What is the relevence to Computer Graphics?
What this simplified model of photography can tell us is why cameras are good at coping with wider ranges of intensities. Let's consider the initial exposure of the film to the light of the scene. Imagine that there are one hundred molecules of light sensitive chemical in some small area of film. Light falls on that small area, and half of those molecules break down. So the resultant image will be half bright when it's developed. If the same amount of light falls again on the same area, then half of the remaining molecules will again break down, leaving a quarter. The resultant image would now be 75% bright. As more and more light falls on an area of film, so more and more molecules break down. However,
as less and less chemical remains on the film, you need more and more light to break down the same amount again.
This graph shows how the amount of chemical remaining on the film falls the more light hits it. The chemical breaks
down quickly initially, but, as less and less chemical is left it breaks down more slowly, and eventually (obviously)
stops breaking down when none is left.
Actually, this is a very simplified and stylised diagram. Real film is not quite as smooth and perfect. Infact the graph
should begin to rise again as the film recieves a large dose of light. This effect is known as solarisation.
You may recognise this as an exponential decay graph. This is exactly what it is. The rate of decrease is proportional
to the amount remaining, since the more chemical there is on the film, the faster it will break down.
So, taking the previous graph, it is a simple matter of turning it upside down to find out how transparent the film
becomes after a certain amount of light has hit it, and thus how bright the resulting photograph should be.
In all, it comes down to one simple function:
brightness = 1 - e-light
Now that you have this simple function, you are all powerful and you can easily handle a huge range of brightnesses, and
still make them look good on screen. Don't believe me? take a look at the picture on the left. It is the same image as the
two above, but has been blessed with the Exposure Function. The sun is brighter than the sky, which is brighter than the land,
as it should be, and all details are still visible. Nothing has been lost.
Of course, a camera would be quite useless without exposure control, as is this function. The amount of light that
hits the film is simply the product of the light entering the camera, and aperture, and the length of time the shutter
is open for. To simplify things more, we can ignore the difference between aparture and shutter speed, and lump them
into a single variable K. Smaller values of K will result in darker images, and vice versa.
(light hitting film) = (light entering camera) * K
brightness = 1 - e-(light hitting film)
Finally, lets see some pseudocode:
function Expose(float light, float exposure)
return ( 1 - exp(light * exposure) ) * 255
for every pixel on the screen
calculate the amount of light entering the camera for this pixel, by Ray Tracing or whatever
call this value L
PixelValue = Expose(L, K)
plot this pixel with a brightness of PixelValue
end of loop
end of main procedure
It's amazing this function does not get used more. Even powerful rendering programs like 3D Studio produce nasty,
clipped-brightness images, and don't allow you to create lights with a brightness greater than 255. This kind of limitation
is quite ridiculous, since in real life, lights come in a huge range of brightnesses.
The Virtual Darkroom http://tangle.seas.gwu.edu/~geigel/vdr/
A system that takes computer generated images and renders them in black and white using the principles of photographic
film processing. This is a very much more advanced piece of software than the simplified algorithm above, and simulates
grain, and both exposure processes.
Return to the Good Looking Textured Light Sourced Bouncy Fun Smart and Stretchy Page.