Java Reference
In-Depth Information
Figure 9. Point light and result
1
[
]
Light
Intensity
=
Attenuatio
n
Array
=
a
a
a
d
=
Distance
2
a
+
a
d
+
a
d
0
1
2
0
1
2
a
=
1
a
=
0
a
=
10
a
=
1
a
=
10
a
=
0
a
=
1
a
=
0
a
=
0
0
1
2
0
1
2
0
1
2
As illustrated in Figure 9, rays from a point source are emitted at all direction from the
source. Line 36 in Figure 6 gives an example for creating a point light source by using the
constructor PointLight(). The first argument in this constructor gives the light color emit-
ted, the second gives the position of the source, while the last argument is a float array with
three attenuation constants that will be used to calculate how the light will be attenuated
as it propagates from the source.
Figure 9 also shows the equation for giving the light intensity as a function of distance
as well as the results for three different sets of attenuation constants. The figure also shows
the result obtained in the example of Figures 5 and 6. Again, note that reflections will be
based on vertex and face normal, and the appropriate capabilities must be set if it is desir-
able to change certain parameters of a point light when running the program.
Search WWH ::




Custom Search