Example 12. Grayscale Rendering of Perpendicular Half-Planes
Gray is actually a color if you think about the grayscale as being the line connecting black (K) to white (W) in a Schroedinger cube. It is a special line, because the R, G, B values of any point on this line are, obviously, equal to each other. Even when we are working purely in gray, we utilize RGB monitors and other devices, and we can implement computer code that still uses all three channels to represent gray. In this example, all coding has been done as if we were working with full RGB color.
The human eye is limited to seeing only about 256 levels of gray. If gray blocks are placed next to each other in a colorbar, human perception sees these blocks as being non-uniform in gray. That is called the Mach Effect. (You might see some as the image, below, is displayed.) Rendering images for depth or 'depth queuing', would seem to utilize the inverse-square-law for the fall-off of light intensity with distance. Double the distance from a point light source, and you receive only one-fourth as many photons per time interval. Graphic artist use a number of techniques to queue our eye for depth, including grayscale rendering such as shown here.
In this example, we attempt to trick the eye into seeing shaded rectangles as infinite half-planes. Unlike a graphic artist, we will not use trapezoids or the like to influence perception. Instead, we use only grayscale shading as determined by a single mathematical function with a single variable equal to the width of the rectangle, w. Possible functions to try include exponents, polynomials, trigonometric functions, etc. In fact, some of these have already been tried in the computer code that generated image 12.1, below.
Image12.1 Animated gif of the rendering of rectangles by incrementing a power of width .
The 33 images within this animation progress through w^p, where w is the width of the rectangle and y is a power that is incremented from 0 to 4 in steps of 0.25. All images are normalized by dividing by the maximum grayscale value per image. For p = 0, we obtain the uniform white cross that in seen in the first frame of the animation. At p=1, we have a linear relationship between the fall-off of grayscale with the width of the rectangle. It is observed that powers less than one (p<1) yield low contrast, while higher powers of y (e.g., p>3) yield high contrast and rapid fall-off in gray. Somewhere near w^2, akin to the inverse-square-law, there appears to be an optimum for visual perception of the rectangles as infinite planes. This clearly calls for more study, but one will always be dealing with unknowns in human visual perception. We would be pleased to receive email from anyone who finds a better function. That should be easy. Please remember, no perspective lines or vanishing points are allowed.
This computer code is extremely simple and brief. It is provided here in .nb and .PDF formats.