Manipulating lights
A 3D display can use light sources to change how objects appear. Define lights inside a display block. GAMA supports ambient, directional, point and spot lights.
Ambient light​
The special name #ambient sets the ambient light for a display. Its intensity accepts an integer or a color. An integer sets a grayscale intensity; the default intensity is controlled by the OpenGL light intensity preference (180 by default).
light #ambient intensity: #red;

Directional lights​
A directional light uses a direction vector and has no location. It does not use positional attenuation. The special name #default replaces the display's default directional light.
light #default kind: #direction direction: {0.5, 0.5, -1} intensity: #white;
light "sun" kind: #direction direction: {1, 1, 1} intensity: #red;

Point lights​
A point light has a location in model coordinates. Its intensity decreases with distance according to its attenuation facets. The constant, linear and quadratic attenuation values default to 1, 0 and 0, respectively.
light "lamp" kind: #point location: {10, 20, 10} intensity: #red;

Attenuation can be adjusted with constant_attenuation, linear_attenuation and quadratic_attenuation:
light "lamp" kind: #point location: {10, 20, 10}
intensity: #red linear_attenuation: 0.1;

Spot lights​
A spot light has a location, a direction and an angle in degrees. Its angle defaults to 45 degrees. Positional attenuation facets can also be used.
light "spot" kind: #spot location: {0, 0, 100}
direction: {0.5, 0.5, -1} angle: 30 intensity: #red;

Default light​
A display uses default ambient and directional lighting. The #ambient and #default names let a model redefine these sources. Their default intensity is taken from the OpenGL light intensity preference, which defaults to 180.

Showing light sources​
Set show: true on a light to draw a visual representation of its source in the display. The representation can help inspect its location or direction. It is off by default.
light "lamp" kind: #point location: {10, 20, 10} intensity: #red show: true;
light "sun" kind: #direction direction: {1, 1, 1} intensity: #green show: true;
light "spot" kind: #spot location: {0, 0, 100}
direction: {0.5, 0.5, -1} angle: 30 intensity: #blue show: true;

Light facets​
The light statement is available inside a display. Each name should be unique; if the same name is defined more than once, the last definition is used. The kind facet accepts #direction, #point or #spot. The older type facet is deprecated in favor of kind.
| Facet | Purpose |
|---|---|
kind | Selects a directional, point or spot light. |
location | Sets the position of a point or spot light in model coordinates. |
direction | Sets the direction of a directional or spot light. |
angle | Sets the spot angle in degrees. |
intensity | Sets intensity as an integer or color. |
active | Enables or disables the light; defaults to true. |
show | Draws a representation of the light; defaults to false. |
constant_attenuation, linear_attenuation, quadratic_attenuation | Set attenuation for positional lights. |
dynamic | Controls whether light parameters are updated each cycle; defaults to true. |