14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13 Three-Dimensional Scenes 455<br />

Lighting and Normals<br />

Table 13.3 Light Parameters and Default Values<br />

Parameter<br />

Default<br />

Value<br />

Meaning<br />

DIFFUSE (1, 1, 1, 1) diffuse RGBA intensity<br />

SPECULAR (1, 1, 1, 1) specular RGBA intensity<br />

POSITION (0, 0, 1, 0) (x, y, z, w) position<br />

SPOT_DIRECTION (0, 0, -1) (x, y, z) direction of spotlight<br />

SPOT_EXPONENT 0 spotlight exponent<br />

SPOT_CUTOFF 180 spotlight cutoff angle<br />

CONSTANT_ATTENUATION 1 constant attenuation factor<br />

LINEAR_ATTENUATION 0 linear attenuation factor<br />

QUADRATIC_ATTENUATION 0 quadratic attenuation factor<br />

Note: The default values for DIFFUSE and SPECULAR in this table only apply to Light 0. For other lights,<br />

the default value is (0, 0, 0, 1) for both parameters.<br />

The first three parameters (AMBIENT, DIFFUSE, and SPECULAR) are used to color the light. DIFFUSE is the<br />

parameter that is most closely associated with the physical color of the light. AMBIENT refers to the property<br />

of the light when it functions as a background light. SPECULAR alters the way a light is reflected off a<br />

surface.<br />

Specify the position of the light using the POSITION parameter. Nonzero values of the fourth (w) coordinate<br />

position the light in homogenous object coordinates.<br />

Light in the real-world decreases in intensity as distance from the light increases. Since a directional light is<br />

infinitely far away, it does not make sense to attenuate its intensity as a function of distance. However, JSL<br />

attenuates a light source by multiplying the contribution of the source by an attenuation factor<br />

1<br />

attenuation factor = ---------------------------<br />

c+ ld+<br />

qd 2<br />

where c = CONSTANT_ATTENUATION, l = LINEAR_ATTENUATION, and q = QUADRATIC_ATTENUATION.<br />

To create a spotlight, limit the shape of the light to a cone. Use the SPOT_CUTOFF parameter to define the<br />

side of the cone, as shown in the following illustration.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!