3.4. Lights and Shadows

Lighting in Anableps can be controlled in a precise way. Lights are added to the scene as regular bodies, although they are by default hidden.

Note that different renderers will make a different use of the lights. so not all parameters are taken into account by every render. For details, see below.

In the same way, shadows are defined by the light, but they will be displayed in different ways. Section Shadows explain how to configure them with the different renderers.

3.4.1. Description of lights

  • fadeout: square?

3.4.1.1. General light parameters

Each particular light have its own parameters, but all share some common ones

Common parameters to all lights

  • up: the up vector if intensity is given as a two-var function
  • affects: choose which objects are affected. defaults to all.
  • ignores: choose which object are not touched Defaults to none.
  • color: color of the light. It can be given as a temperature-of color.
  • intensity: intensity of the light, expressed in lumens, W/m2, or nits. A function of two parameters can be given, understanding the variables as theta and phi. phi=0 at the up
  • angularProfile: a function with intensity 0 to 1, depending on two variables, the angles phi and theta.

Example:

light.cone l1
    : .intensity = fn(theta, phi) : theta^2 + phi
    : .color yellow

3.4.2. Cheating and tweaking lights

Lights can be turned on and off selectively. This selection can be done on the lights or on the objects: each light can be set to affect only some objects, and an object can opt in or out to any light.

Objects can be grouped HOW?

Examples selecting at body level:

DirLight l1: .from <1,1,1> .color white .direction <1,0,0>
DirLight l2: .from <2,2,2> .color yellow .direction <2 0 0>
cube d: .size 2 2 2 cm
cube c: .as d : .place 2 2 2 : ignoreLight l1

Each light can affect:

DirLight l1: .from <1,1,1> .color yellow .affects c1 c2 c3 .ignores c4

In case a light explicitely states that affects an object that ignores it, a warning will be issued, but the object’s preference will be used

3.4.3. Kinds of lights

There are several kinds of lights available:


3.4.3.1. Ambient light

Ambient light is light that comes from all directions. This is a non-placeable object that is added to the scene. There can be as many as wanted, and they will sum up.

If there is no ambient light defined in an scene, a default one will be added with the following values:

  • .intensity: xx cd/m2.
  • .color: white

3.4.3.2. Directional light

A Directional light is lights that baths the whole space from a direction. As with ambient light, there can be as many as needed. There is no default directional light in scenes.

As this light is a non-placeable object added to the scene, it displays in the silk layer as an icon.

TODO:Example (with a figure) for a directional light illumination

3.4.3.3. Focal light

Light that projects in a cone from a point

3.4.3.3.1. parameters:

In addition to the general light parameters

  • angle: max angle, if nothing else set, it will behave as a cone.
  • .sharpness: angle to the value of 0.5 max
  • pupil: A shape to cut
    • .distance: distance of the pupil from the light

3.4.3.4. Area light

Light that comes from an area

Note:For the BREP renderers, the area is modelled using addition functions, that modify the exponent for decay with distance.

3.4.3.4.1. Parameters:

In addition to the general light parameters

  • area: area from where the light comes off

Additionally to the generic light parameters


3.4.3.5. Photometric lights

Photometric lights take information from real source experiments, so its radiance vs angle function is a interpolation of real-world experimental data.

There are several photometric lights available in the library, under things.lights., like lightbulb, led1, led2. See library reference for more information.

External photometric information can be loaded using the parameter .profile

In addition to the general light parameters

  • profile: an array of angle angle color intensity
TODO:asdfsafs

3.4.3.6. Internal light

In addition to the general light parameters

Light shinning from inside an object. That is, radiance of the object.

3.4.4. Lights and time

Lights can be switched on and off when animations are perfomed. For that, use the switching parameter.

Note that if the on-off switching is faster that one frame, WHAT HAPPENS?