Spherical Environment Mapping with OpenGL
ARTICLE NOT FINISHED
Recently I found this great tutorial on spherical environment mapping which is an easy solution to add some detailed lighting to a visualisation. The great thing about this technique, is that you can use a simple 2D texture to define how the lighting and reflection of you model looks. This gives you an extremelly easy tool for fine tuning the appearence of your objects.
I'm going to describe my implementation here, which is basically the same as the above linked one; this is just one for my reference. Another great and more indepth article on how this technique works is described in this description from 1999 by Paul Zimmons.
Describing the environment
There are a couple of common techniques that are used with environment mapping. You have spherical, cubic and parabolic environment mappings all with their own pros and cons. Spherical mapping has the great advantage that is just uses one texture and it's cheap to perform the necessary calculations.
Below you can see how these spherical environment images, also called matcaps, look like. When you google for matcap, lit sphere, light probe you'll find a lot of these images. That's how I found the image below ... not knowing who the owner is (sorry)...
You can think of this image as a description of how your object will be shaded. From below it will have red/dark color shades and from the top it will be bright. When rendering an arbitrary object I created with blender (with normal mapping) you get something like this:
In your vertex shader we will be calculating the texture coordinate that we need to use with our matcap texture. The mapping between the texture coordinate and matcap is described in geat detail in the article of Paul Zimmons.