Wednesday, February 27, 2008

Manual Depth Perception (OpenGL Shading)

Shadows play a tremendous roles in our visual understanding of depth. This can be used to trick the eye:

In the above image, the color of square B is, in fact, the same as that of square A. Don't believe me? These are small crops of the above image:

However, shadows are also very important to aid the eye. Or so we learned in Graphics. So we had to make shadows for a map. Manually.

Here's the m
ap without shadows. Green is lowland, red is highland, black and white even higher.

And, with shadows:

Aiding, huh? Aaaand, just the shadows... Please note that each of these pixels is calculated based on two values - an evelation coordinate (z) of the map at any given point (x,y), and a static directional (x,y,z) vector of sun light.

No comments: