GAMGI Tutorials: Directional and positional lights

# Directional and positional lights

- Page 1
- Page 2

We demonstrate here the three types of lights that GAMGI (and OpenGL) supports, plus other illumination issues. First we create an atom with a large curved surface, that we will use as a target, then we create the various lights and point them to the surface.

### Directional light

1. Press Atom->Create and set Element to O, Position to (0.0, 0.0, 0.0), Style to Solid and Scale to 15.0. After pressing Ok, a large sphere representing the new atom becomes visible, seen as a circle because tridimensional effects cannot be seen in the absence of diffuse and specular light components.
2. Press Light->Create and set color Ambient (Color page) to (0.0, 0.0, 0.0), and Diffuse to (0.8, 0.8, 0.8). After pressing Ok, a default Directional light is created, illuminating the atom sphere, whose shape is now clearly visible.
3. To select the light, either: 1) press the mouse middle button over the top menu where it says Light, and then press the mouse over the drawing area; or 2) press Light->Select, to open the dialog to select lights, and then press the mouse over the drawing area. In both cases, a menu pops up, showing one menu item, for the only light available. After choosing this light, it becomes the selected object.
4. Press the left button and dragg the mouse to rotate the light direction, exactly as if rotating a molecule.

### Positional light

1. Press Light->Modify and press the mouse over the drawing area. A menu pops up, showing one menu item, for the only light available. After choosing this light, confirm its properties and then set Light to Positional. After pressing Ok, the light becomes positional, with the new parameters.
2. Press the middle button and dragg the mouse to move the light position, exactly as if moving a molecule.

### Spot light

1. Press Light->Modify and press the mouse over the graphic area. A menu pops up, showing one menu item, for the only light available. After choosing this light, confirm its properties, in particular the new light position, that was changed with the mouse.
2. Set Light to Spot and Angle to 10.0. After pressing Ok, the light becomes a spot, with the new parameters. Because the beam angle cutoff is only 10 degrees and the light is only 10 length units away, only the central part of the atom sphere is illuminated (setting angle to 1.0 emulates a laser).
3. Press Light->Create and set color Ambient to (0.4, 0.4, 0.4) and Diffuse to (0.0, 0.0, 0.0). After pressing Ok, a second light is created, and its weak ambient light illuminates the whole atom as a halo. The selected object is still the first light.
4. Press the left button and dragg the mouse to rotate the light direction, exactly as if rotating a molecule. Press the middle button and dragg the mouse to move the light position, exactly as if moving a molecule. Press the right button and dragg the mouse to increase or decrease the angle cutoff, exactly as if scaling a molecule.

Home