next up previous contents index
Next: Atmospheric effects Up: Scene Description Files Previous: Scene File Comments   Contents   Index


Lights

The most frequently used type of lights provided by Tachyon are positional point light sources. The lights are actually small spheres, which are visible. A point light is composed of three pieces of information, a center, a radius (since its a sphere), and a color. To define a light, simply write the LIGHT keyword, followed by its CENTER (a X, Y, Z coordinate), its RAD (radius, a scalar), and its COLOR (a Red Green Blue triple). The radius parameter will accept any value of 0.0 or greater. Lights of radius 0.0 will not be directly visible in the rendered scene, but contribute light to the scene normally. For a light, the color values range from 0.0 to 1.0, any values outside this range may yield unpredictable results. A simple light definition looks like this:
  LIGHT CENTER 4.0 3.0 2.0 
        RAD    0.2 
        COLOR  0.5 0.5 0.5
This light would be gray colored if seen directly, and would be 50% intensity in each RGB color component.

Tachyon supports simple directional lighting, commonly used in CAD and scientific visualization programs for its performance advantages over positional lights. Directional lights cannot be seen directly in scenes rendered by Tachyon, only their illumination contributes to the final image.

DIRECTIONAL_LIGHT 
  DIRECTION 0.0 -1.0 0.0
  COLOR   1.0 0.0  0.0

Tachyon supports spotlights, which are described very similarly to a point light, but they are attenuated by angle from the direction vector, based on a ``falloff start'' angle and ``falloff end''angle. Between the starting and ending angles, the illumination is attenuated linearly. The syntax for a spotlight description in a scene file is as follows.

SPOTLIGHT 
  CENTER  0.0 3.0  17.0 
  RAD     0.2
  DIRECTION 0.0 -1.0 0.0
    FALLOFF_START 20.0
    FALLOFF_END   45.0
  COLOR   1.0 0.0  0.0

The lighting system implemented by Tachyon provides various levels of distance-based lighting attenuation. By default, a light is not attenuated by distance. If the attenuation keywords is present immediately prior to the light's color, Tachyon will accept coefficients which are used to calculate distance-based attenuation, which is applied the light by multiplying with the resulting value. The attenuation factor is calculated from the equation

\begin{displaymath}
\frac {1} {K_c + K_l d + k_q d^2}
\end{displaymath} (1)

This attenuation equation should be familiar to some as it is the same lighting attenuation equation used by OpenGL. The constant, linear, and quadratic terms are specified in a scene file as shown in the following example.

LIGHT  
  CENTER  -5.0 0.0 10.0   
  RAD     1.0
  ATTENUATION CONSTANT 1.0 LINEAR 0.2 QUADRATIC 0.05
  COLOR   1.0 0.0 0.0


next up previous contents index
Next: Atmospheric effects Up: Scene Description Files Previous: Scene File Comments   Contents   Index
johns@megapixel.com