<light> ‐ A light
Name | Type | Defaults |
---|---|---|
id | ID | None (required) |
type | STRING | None (required) |
fade_distance | FLOAT | 1000.0 |
fade_power | INTEGER | 0 |
radius | FLOAT | 30.0 |
constant_attenuation | FLOAT | 1.0 |
linear_attenuation | FLOAT | 0.0 |
quadratic_attenuation | FLOAT | 0.0 |
falloff | FLOAT | 45.0 |
tightness | FLOAT | 0.0 |
spot_exponent | FLOAT | 0.0 |
begin | FLOAT | None (required for strobolight) |
end | FLOAT | None (required for strobolight) |
duration | FLOAT | None (required for strobolight) |
period | FLOAT | None (required for strobolight) |
shadow | BOOLEAN | false |
This element defines a light source.
The string value of the type attribute is equal to light in the case of a point light. It is equal to strobolight in the case of an intermittent spot light such as a stroboscope. The values spotlight and cylinder correspond respectively to a conical spot light and a cylindrical spot light. Last, parallel defines a directional light.
The float value of the fade_distance attribute and the integer value of the fade_power attribute define the light attenuation with respect to distance. The float values of the radius and falloff attributes define the angular attenuation of a spot light in POVray (see Figure 5-10 for a geometrical description of these attributes). In POVray, the float value of the tightness attribute controls the way that light tapers off at the edge of the cone. In OpenGL, the values that define the angular attenuation of a spot light are the radius attribute (an angular cutoff) and spot_exponent attribute (a coefficient for angular attenuation around cutoff value).
The float values of the constant_attenuation, linear_attenuation, and quadratic_attenuation attributes define the three OpenGL attenuation factors used to compute light attenuation according to figure Figure 5-11
In the case of an intermittent spot light, the float values begin and end of the begin and end attributes define the maximal time interval during which the light is on. Lighting begins at begin time and is stops at end time. The float value period of the period attribute is used to define the intervals at which lighting is restarted. Lighting is periodically restarted at begin+n×period for n in 1, 2,...,N. N is the the largest integer smaller than or equal to (end-begin)/period. The float value duration of the duration attribute must be smaller than or equal to period; it defines the lighting time during each period (see Figure 5-12).
The value of the radius attribute is used to define a square bounding box centered at the location of the light source. A light source can be selected and dragged by the pointing device if the boolean attribute interactable of the node is true.
This element can have three element in its scope: two points that define the location and the direction of the spot light and color that defines the color of the light source.
The following elements must occur in light: two point elements indexed 1 and 2, and a color or a material element. The default values for the point elements are (0,0,0) for the point with index 1, and (0,0,-1) for the point with index 2.
The example below defines a spot light that casts shadows. Its color is red, it is located at the origin of the local coordinates, and is directed towards the positive x-axis.
<light id="light_#2.red" fade_distance="10.0" fade_power="1" radius="30" falloff="45" tightness="1" shadow="true" type="spotlight"> <color id="reddish" r="0.9" g="0.15" b="0.1"/> <point index="1" x="0.00" y="0.00" z="0.00" /> <point index="2" x="1.00" y="0.00" z="0.00" /> </light>
The example below defines a directional light. Its ambient component is white and there is no diffuse and specular component. It is located at the origin of the local coordinates, and is directed towards the positive z-axis.
<light id="light_#1" type="parallel"> <material id="mat_1"> <ambient r="1.0" g="1.0" b="1.0" a="1.0" /> <diffuse r="0.0" g="0.0" b="0.0" a="1.0" /> <specular r="0.0" g="0.0" b="0.0" a="1.0" /> </material> <point index="1" x="0.0" y="0.0" z="0.0" /> <point index="2" x="0.0" y="0.0" z="1.0" /> </light>