Java Reference
In-Depth Information
In line 35 in Figure 13, a linear fog object is created with the first three parameters giving
the RGB color of the fog to be used, and the last two parameters giving backDistance and
frontDistance.
On the other hand, the blending factor for exponential fog depends only on a density
factor and is given by
1
f
=
(
)(
)
exponentia
l
e
density
DistanceFr
omViewPort
Exponential fog can often give rise to a more natural result at the expense of higher
rendering time. The density factor controls the amount of exponential decrease in the use
of fog as we move away from the camera. Setting the density factor to zero is equivalent
to not using fog at all. The higher the density factor, the less visible it will be for distant
objects. A density close to one will enable the viewer to see only nearby objects, with other
objects in the scene covered by the fog used. In line 34 in Figure 13, an exponential fog
object is constructed with the first three parameters giving the RGB color of the fog, and
the last parameter giving the density factor.
Figure 14. Results from using fog
Linear fog
frontDistance = 10
backDistance = 100
Linear fog
frontDistance = 0.1
backDistance = 20
Without using fog
Exponential fog
Density = 0.33
Exponential fog
Density = 0.66
Search WWH ::




Custom Search