Java Reference
In-Depth Information
Figure 15. Using fog with influencing bound smaller than the distances to some objects
Based on the code segment of Figures 12 and 13, Figure 14 presents some results ob-
tained using different fog settings. As can be seen, the original scene consists of a series
of objects with sharp edges at different distances. The resolution is good, but the image
has an artificial feeling. The use of fog reduces the resolution for distant objects, but gives
rise to a smoother and more natural effect.
The influence of fog on the image rendered depends on the frontDistance and back-
Distance for the case of linear fog and on the density factor for the case of exponential fog.
This is clearly illustrated in Figure 14.
Apart from these parameters, there are two other bounds or parameters that can determine
whether objects will be influenced by the fog created. As set in lines 36 to 38 in Figure 13,
the setting of a clipping bound by using Clip(clipDistance) will disable the rendering of
all polygons lying beyond the clipping distance. By choosing a good clipping distance that
matches the fog backDistance or effective distance that can possibly be seen by viewer, the
task of rendering can be made more efficient, leading to a faster system.
In addition to the clipping bound, an influencing or activation bound for the fog can
also be set. This is done in lines 39 to 41 in Figure 13 and, as illustrated in Figure 15, may
produce interesting results. In this figure, the influencing bound of the fog is smaller than
that needed to cover all the objects. As a result, some distant objects that fall outside the
bound are rendered in the usual manner. Note that the default for the influencing bound
for fog is 0 in Java 3D, corresponding to subjecting no object to the fog. Thus, in order for
the effect of fog to be rendered, the influencing bound must be properly set.
Search WWH ::

Custom Search