lightlab(1)

lightlab1

Experiment with the opengl lighting model

Usage

lightlab

Overview

This program lets you set the colors and positions of three GTK light sources, and watch the effect that has on a simple 3D scene.

Here is a quick overview of OpenGL lighting concepts. If this isn't enough for you, check the man pages, or get a book on OpenGL, such as the one mentioned below.

Lights have three colors associated with them, and so do objects. The color of a surface in a scene is determined by the combination of the colors of the surface and the colors of the lights shining on it.

Ambient lighting

Light so scattered it can be considered to come from every direction equally. If a light in the scene has ambient light set, then a uniform, non-positional light of that color will hit all objects.

Diffuse lighting

Directional lighting that will reflect from surfaces according to their normal vectors. Ambient light hitting a surface directly will be brigher than ambient light hitting at an angle.

Specular lighting

Like diffuse lighting, but the light shines back in a particular direction, depending on the Shininess of the surface. The more shiny the surface, the more focused a specular reflection.

The X, Y, and Z positions of each light are divided by the "W" value (in this program, called "Divisor") to get the actual position. If the divisor is 0, then the distance is infinite, and the XYZ coordinate defines a vector pointing at an infinitely far light whose intensity does not decrease with distance (e.g., the sun.)

If the divisor is non-zero, then it specifies the distance of the light from the origin along the XYZ vector.

Environment

DISPLAY

to get the host and display number on which to open the window.

The latest version of

Upgrades

lightlab(1) can always be found at http://www.jwz.org/lightlab/

Releases

2 releases since Debian 3.0 (Woody); the text changed 1 time.

  1. 3.0
  2. 3.1

Author

Jamie Zawinski <[email protected]>, March 2002.

This program was inspired by a like-named GLUT program by Mark J. Kilgard. His program allowed one to turn lights on and off, and set the color of objects as a demo of how lighting works, but did not allow one to experiment with specific light positions colors. So, I wrote my own.

For learning OpenGL programming, I highly recommend Mark's book, "OpenGL Programming for the X Window System", Addison-Wesley 1996, ISBN 0-201-48359-9.

From lightlab 0.3-3 in Debian 3.1 (Sarge). Parsed by carta from the page's man source.