i
i
i
i
i
i
i
i
310 8. Area and Environmental Lighting
32 x 3216 x 168 x 84 x 4
Figure 8.19. An example of a cube map mip chain filtered with Gaussian lobes of in-
creasing width. Note that this creates a visual impression of changing surface roughness.
(Images using CubeMapGen courtesy of ATI Technologies Inc.)
contribution, dropping o as the direction to the incoming light increas-
ingly differs from the reflected view direction. The area of the EM texel
multiplied by the texel’s BRDF contribution gives the relative effect of this
texel. This weighted contribution is multiplied by the color of the EM
texel, and the results are summed to compute q. The sum of the weighted
contributions, s, is also computed. The final result, q/s, is the overall color
integrated over the reflected view direction’s lobe and is stored in the re-
sulting reflection map. When combined with a Fresnel term, such reflection
maps work well for glossy surfaces.
For surfaces with spatially varying roughness, an effective approach
is to store environment maps filtered with Phong or Gaussian lobes of
different widths in the mipmap levels of a single texture (usually a cube
map) [443, 830, 831]. This works well, since the blurrier maps are stored in
the lower-resolution mipmap levels. ATI’s CubeMapGen is an example of
a tool that can generate such mip chains. Figure 8.19 shows an example.
When accessing such mip chains, the index of the mipmap level that cor-
responds to the current filter width can be easily computed in the shader.
However, always using this mipmap level may result in aliasing when mini-
fication requires lower-resolution mipmap levels to be used. Ashikhmin and
Ghosh point out [45] that for best results, the indices of the two candidate
mipmap levels (the minification level computed by the texturing hardware
and the level corresponding to the current filter width) should be com-
pared, and the index of the lower resolution mipmap level used. When
the roughness is constant over a mesh, the texturing hardware can be con-
figured to perform this mipmap level clamping automatically. However,
when the roughness varies per pixel, this requires the hardware-computed
mipmap index to be accessed in the pixel shader so the comparison can be
performed. Since pixel shaders lack the ability to get the mipmap index
i
i
i
i
i
i
i
i
8.5. Glossy Reflections from Environment Maps 311
thatwouldbeusedforagiventexture access, a common technique is to
store the mipmap index in the alpha channel of the texture. The environ-
ment map texture is first accessed using a standard texture read operation
(which requires the texturing hardware to compute an appropriate mipmap
level). The alpha channel of the result is compared to the mipmap index
corresponding to the current filter width. The index of the lower resolution
mipmap level is used to access the environment map texture again, this
time using a texture read operation that allows for specifying the mipmap
index directly.
For a view-independent EM representation such as a cubic or parabolic
map, the color stored is valid for all mirror reflections in that direction,
regardless of the viewer’s location. The EM, in fact, stores radiance values
of the incoming illumination—it does not matter how this data is accessed.
A variety of eye and surface orientations can generate the same reflected
view direction, for example. In each case, the radiance in that direction is
the same.
However, this same independence does not hold when the EM is filtered
to create a reflection map. A single reflection map is sufficient only if all
viewing and surface directions that yield the same reflected view direction
have the same shaped specular lobe. This is never the case for anything but
perfect mirror surfaces. Think about viewing a shiny (not mirror) sphere
from in front and nearly behind it. When in front, a ray reflecting from
the sphere that goes straight back may have, say, a symmetric Phong lobe.
From nearly behind, a ray reflecting the same direction must in reality have
a piece of its lobe cut off. See Figure 8.20. The filtering scheme presented
earlier assumes that all lobes for a given reflected view direction are the
same shape and height. In fact, this means the lobes also have to be radially
Figure 8.20. A shiny sphere is seen by two viewers. Separate locations on the sphere give
the same reflected view directions for both viewers. The left viewer’s surface reflection
samples a symmetric lobe. The right viewer’s reflection lobe must be chopped off by the
horizon of the surface itself, since light cannot reflect off the surface below its horizon.
i
i
i
i
i
i
i
i
312 8. Area and Environmental Lighting
symmetric. Beyond the problem at the horizon, most BRDFs do not have
uniform, radially symmetric lobes at all angles; at grazing angles the lobes
often become sharper and thinner. Also, the lengths of the lobes normally
vary with elevation angle.
This effect usually is not noticeable for curved surfaces. However, for
flat surfaces such as floors, radially symmetric filters can introduce notice-
able errors (see Section 7.5.7 for a detailed explanation).
Kautz and McCool address the problem by approximating the BRDF
with multiple lobes, resulting in several reflection maps added
together [626]. Their approach requires an array of reflection maps, one for
each lobe.
McAllister et al. [830, 831] present a method for representing spatially
variant BRDFs (SVBRDFs) with textures containing multiple coefficients
for the Lafortune BRDF [710]. Since Lafortune lobes are generalized Phong
lobes, a single environment map texture can be used where the mipmap
levels are filtered with different Phong cosine exponents. This approach en-
ables rendering a variety of BRDF effects, including anisotropy and retrore-
flection with environment maps.
Green et al. [443] propose a similar method, which uses Gaussian lobes
instead of Phong lobes. Their fitting process is much faster than McAllis-
ter’s. In addition, their approach can be extended to support directional
shadowing of the environment map (see Section 9.10.2).
Colbert and Kˇriv´anek [187, 188] describe a high-quality algorithm that
supports arbitrary BRDFs. It is quite expensive, requiring 20 to 40 reads
from the environment map, but reproduces the effects of integrating over
the environment map with the actual BRDF. Colbert and Kˇriv´anek’s al-
gorithm uses a method called Monte Carlo quadrature with importance
sampling, which is also used in ray tracing. It is based on the idea that
the integral of a function can be approximated by taking random samples,
weighted to occur more often in areas where the function is expected to
have high values.
Filtering environment maps as a pre-process is straightforward, and
toolssuchasATIsCubeMapGen are available to assist in this process.
If the environment maps are dynamically generated, efficient filtering can
be difficult. The auto-generated MIP map levels provided by most APIs
may be sufficient for some needs, but can result in artifacts. Kautz et
al. [627] present a technique for rapidly generating filtered parabolic re-
flection maps. Hensley et al. [542, 543] present a method to interactively
generate summed-area tables (see Section 6.2.2), which are subsequently
used for high-quality glossy reflections.
An alternative to regenerating the full environment map is to add the
specular highlights from dynamic light sources onto a static base environ-
ment map. This technique can be an alternative way to solve the light-
i
i
i
i
i
i
i
i
8.5. Glossy Reflections from Environment Maps 313
shader combinatorial problem discussed in Section 7.9, since the effect of
any number of light sources can simply be handled through the environ-
ment map. The added highlights can be prefiltered “blobs” that are added
onto a prefiltered base environment map, thus avoiding the need to do any
filtering at run time. The limitations are due to the assumptions of envi-
ronment mapping in general: that lights and reflected objects are distant
and so do not change with the location of the object viewed. This means
that local light sources cannot easily be used. Using EM often makes it
difficult for an object to move among different lighting situations, e.g., from
one room to another. Cubic environment maps can be regenerated on the
fly from frame to frame (or once every few frames), so swapping in new
specular reflection maps is relatively inexpensive.
8.5.1 View-Dependent Reflection Maps
The reflection map approaches discussed above are view-independent.
View-dependent representations such as sphere maps can also be used for
reflection maps. Since sphere maps are defined for a fixed view direction, in
principle each point on a sphere map defines not just a reflection direction,
but also a surface normal (see Figure 8.13 on page 303). The reflectance
equation can be solved for an arbitrary isotropic BRDF and its result stored
in a sphere map. This BRDF can include diffuse, specular, retroreflective,
and other terms. As long as the illumination and view direction are fixed,
the sphere map will be correct. Even a photographic image of a real sphere
under real illumination can be used, as long as the BRDF of the sphere is
uniform and isotropic.
Although this approach supports more general BRDFs than other fil-
tering approaches, there are some drawbacks. If the view direction ever
changes, then the sphere map has to be recomputed. Even for a single
frame, the view position changes due to perspective. This may cause errors
at grazing angles unless different sphere maps are computed for different
parts of the scene or an orthographic projection is used.
Cabral et al. [149] use an image warping approach with multiple sphere
maps to get around the limitations of a single sphere map. In their scheme,
20 reflection sphere maps are generated for orthographic views located at
the vertices of an icosahedron imposed on the scene. For any given view,
the three sphere maps that are closest to the view direction (essentially, the
three views at the vertices of the icosahedron face that the view is on) are
warped and blended using barycentric coordinates. The resulting sphere
map is then used for that view. This method avoids the need to recompute
the reflection map when the view changes.
i
i
i
i
i
i
i
i
314 8. Area and Environmental Lighting
8.6 Irradiance Environment Mapping
The previous section discussed using filtered environment maps for glossy
specular reflections. Filtered environment maps can be used for diffuse
reflections as well [449, 866]. Environment maps for specular reflections
have some common properties, whether they are unfiltered and used for
mirror reflections, or filtered and used for glossy reflections. In both cases,
specular environment maps are indexed with the reflected view vector, and
they contain radiance values.
4
In contrast, environment maps for diffuse reflections are indexed with
the surface normal n, and they contain irradiance values. For this rea-
son they are called irradiance environment maps [1045]. Figure 8.20 shows
that glossy reflections with environment maps have errors under some con-
ditions due to their inherent ambiguity—the same reflected view vector
may correspond to different reflection situations. This is not the case with
irradiance environment maps. The surface normal contains all of the rele-
vant information for diffuse reflection. Since irradiance environment maps
are extremely blurred compared to the original illumination, they can be
stored at significantly lower resolution.
Irradiance environment maps are created by applying a very wide filter
(covering an entire hemisphere) to the original environment map. The filter
includes the cosine factor (see Figure 8.21). The sphere map in Figure 8.11
Figure 8.21. Computing an irradiance environment map. The cosine weighted hemi-
sphere around the surface normal is sampled from the environment texture (a cube map
in this case) and summed to obtain the irradiance, which is view-independent. The
green square represents a cross section of the cube map, and the red tick marks de-
note the boundaries between texels. Although a cube map representation is shown, any
environment representation can be used.
4
Unfiltered environment maps contain incoming radiance values. Filtered environ-
ment maps (more properly called reflection maps) contain outgoing radiance values.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset