This illusion is one of the simplest and best known of a large class of simultaneous contrast effects in which perception of an object's luminance is influenced by the area immediately surrounding it. In this case, two neutral gray squares are drawn, one on a completely white background and the other on a completely black one. When the two squares are drawn using the same shade of gray, the one on the lighter background tends to appear darker.
The demonstration applet allows you to adjust the gray level of each square independently in order to achieve an apparent match. Most people find that it is necessary to make the square on the black background darker in absolute terms in order to achieve a satisfactory match. A comparison mode provides for direct comparison of the two shades of gray once adjustment has led to an apparent match.
When the applet window first appears in its default configuration, both squares are drawn with a 50% gray. You should spend a few moments gauging the strength of the illusory effect. If you are unable to decide which square appears darker then you will need to alter the default settings. Try moving the Right intensity slider control to the right until the difference between the squares is clear, then move the Left intensity slider until the two colours match. Remember to keep your gaze focused on the squares as you do this, not the sliders.
Once you have achieved an apparent match, you can compare the positions of the sliders to get an idea of how different the gray levels are. A more striking comparison can be seen by selecting the Backgounds only switch just above the sliders. When this switch is selected the squares retain their colours, but are expanded to fill the full area. In this mode you can easily match the two colours, then switch back again to see if they still appear the same when the white and black backgrounds are restored.
This strength of this illusion is sometimes diminished by such uncontrollable things as the size of your display screen, the ambient lighting, other windows you have open on the screen, and so on. You may be able to strengthen it by enlarging the applet window to fill most or all of the screen, and by adjusting the size of the squares with the Center size slider control. If you are still having difficulty producing a convincing illusion (or if you are just curious) then you can try selecting the Colour switch. This merely changes the shades of gray to shades of green having the same relative intensities. This can sometimes make the effect more pronounced.
As for all demo applets, the Dismiss button at the bottom of the applet window will remove the window from the screen. Selecting the APPLET link at the top of this page will then return it to the screen just as you left it.
This is the simplest of a set of illusions in this collection that all illustrate problems that can arise when one visual element is viewed in the context of others. The human visual system is very good at such complex tasks as edge detection and compensation for ambient lighting conditions, but in performing these tasks it often alters the stimulus in unexpected ways before its message reaches the conscious part of the brain. In this illusion for example, the squares can appear to be noticeably different shades of gray even when they are in fact the same, or appear the same when they are in fact different.
Rendering algorithms in computer graphics rarely take this sort of effect into account. In general they simply compute the colour of each pixel of the image and trust that when all of the pixels are viewed together the result will be correct. Some general approaches (global illumination for instance) are quite good at determining the influence that different parts of a scene have on each pixel, but only from the point of view of the physical properties of the light in the scene. They make no attempt to anticipate changes that the visual system may introduce after the light has reached the observer's eye.
This is not always a problem. If you simulate the physical characteristics of a scene sufficiently well, then your eyes will react to the rendered image in exactly the same way that they would react to the real scene itself, which is usually the ultimate goal. If any approximations are made or heuristics are used, however, then illusory effects may change the perception of the image in subtle and unexpected ways. It is likely that rendering algorithms will eventually have to employ some knowledge of the human visual system before photo-realistic rendering can be perfected.