i
i
i
i
i
i
i
i
8.4. Environment Mapping 305
Figure 8.14. Illustration of Greene’s environment map, with key points shown. The cube
on the left is unfolded into the environment map on the right.
Figure 8.15. A typical cubic environment map (one of the first, from 1986 [449]). (Image
courtesy of Ned Greene/NYIT.)
time. See Figure 8.16 for an example. Cubic environment mapping is view
independent, unlike sphere mapping. It also has much more uniform sam-
pling characteristics than Blinn and Newell’s method, which oversamples
the poles compared to the equator. Uniformity of sampling is important
for environment maps, as it helps maintain an equal level of quality of re-
i
i
i
i
i
i
i
i
306 8. Area and Environmental Lighting
Figure 8.16. A still from the Xbox game Project Gotham Racing. Glare effects from
the headlights make it clear it is nighttime. A cube map of the environment from the
car’s location is created, each frame to provide dynamic reflections off the car. (Image
courtesy of Bizarre Creations and Microsoft Corp.)
flection across a surface. Wan et al. [1317, 1318] present a mapping called
the isocube that has a lower sampling rate discrepancy than cube mapping
and accesses the cube map hardware for rapid display.
For most applications, cube mapping provides acceptably high quality
at extremely high speeds. Accessing the cube map is extremely simple—
the reflected view vector r is used directly as a three-component texture
coordinate (it does not even need to be normalized). The only caveat is
that r must be in the same coordinate system that the environment map
is defined in (usually world space).
With the advent of Shader Model 4.0, cube maps can be generated in
a single pass using the geometry shader. Instead of having to form six
different views and run the geometry through the pipeline six times, the
geometry shader replicates incoming data into six separate objects. Each
object is transformed using a different view, and the results are sent to
different faces stored in a texture array [261].
i
i
i
i
i
i
i
i
8.4. Environment Mapping 307
Note that since environment maps usually contain high dynamic range
values, care should be taken when generating them dynamically, so that
the right range of values is written into the environment map.
The primary limitation of environment maps is that they only represent
distant objects. This can be overcome by using the position of the surface
to make the cube map behave more like a local object, instead of an object
that is infinitely far away. In this way, as an object moves within a scene, its
shading will be more influenced by the part of the environment nearer to it.
Bjorke [93] uses a cube with a physical location and extent. He casts a ray
from the shaded surface location in the direction of the reflection vector.
The vector from the cube center to the ray-cube intersection point is used to
look up the cube map. Szirmay-Kalos et al. [1234] store a distance for each
texel, allowing more elaborate environments to be reflected realistically.
8.4.4 Parabolic Mapping
Heidrich and Seidel [532, 535] propose using two environment textures to
perform parabolic environment mapping. The idea is similar to that of
sphere mapping, but instead of generating the texture by recording the
reflection of the environment off a sphere, two paraboloids are used. Each
paraboloid creates a circular texture similar to a sphere map, with each
covering an environment hemisphere. See Figure 8.17.
As with sphere mapping, the reflected view ray is computed with Equa-
tion 8.27 in the map’s basis (i.e., in its frame of reference). The sign of the
z-component of the reflected view vector is used to decide which of the two
Figure 8.17. Two paraboloid mirrors that capture an environment using diametrically
opposite views. The reflected view vectors all extend to meet at the center of the object,
the foci of both paraboloids.
i
i
i
i
i
i
i
i
308 8. Area and Environmental Lighting
textures to access. Then the access function is simply
u =
r
x
2(1 + r
z
)
+0.5, (8.33)
v =
r
y
2(1 + r
z
)
+0.5, (8.34)
for the front image, and the same, with sign reversals for r
z
, for the back
image.
The texture transformation matrix is set and used as follows:
1011
0111
0000
0022
r
x
r
y
1
r
z
. (8.35)
The authors present an implementation for this method using the
OpenGL fixed-function pipeline. The problem of interpolating across the
seam between the two textures is handled by accessing both paraboloid
textures. If a sample is not on one texture, it is black, and each sample
will be on one and only one of the textures. Summing the results (one of
which is always zero) gives the environment’s contribution.
There is no singularity with the parabolic map, so interpolation can be
done between any two reflected view directions. The parabolic map has
more uniform texel sampling of the environment compared to the sphere
map, and even to the cubical map. Parabolic mapping, like cubic mapping,
is view-independent. As with sphere maps, parabolic mapping can be done
on any graphics hardware that supports texturing. The main drawback
of parabolic mapping is in making the maps themselves. Cubic maps are
straightforward to make for synthetic scenes and can be regenerated on the
fly, and sphere maps of real environments are relatively simple to photo-
graph, but parabolic maps have neither advantage. Straight edges in world
space become curved in parabolic space. Parabolic maps have to be created
by tessellating objects, by warping images, or by using ray tracing.
One common use of parabolic mapping is for accessing data stored for
a hemisphere of view directions. For this situation only a single parabolic
map is needed. Section 7.7.2 gives an example, using parabolic maps to
capture angle-dependent surface reflectivity data for factorization.
8.5 Glossy Reflections from Environment Maps
While environment mapping was developed as a technique for rendering
mirror-like surfaces, it can be extended to glossy reflections as well. To
i
i
i
i
i
i
i
i
8.5. Glossy Reflections from Environment Maps 309
Figure 8.18. The left figure shows an eye ray reflecting off an object to retrieve a perfect
mirror reflection from an environment texture (a cube map in this case). The right figure
shows a reflected view ray’s specular lobe, which is used to sample the environment
texture. The green square represents a cross section of the cube map, and the red tick
marks denote the boundaries between texels. Although a cube map representation is
shown, any environment representation can be used.
simulate surface roughness, the environment’s representation in the tex-
ture can be filtered [449]. By blurring the environment map (EM) texture,
we can present a rougher-appearing specular reflection. This is sometimes
called a reection map, as it combines the reflectance of the surface with
the EM. In theory, such blurring should be done in a nonlinear fashion; that
is, different parts of the texture should be blurred differently. This is be-
cause environment map texture representations have a nonlinear mapping
to the ideal spherical space of directions. The angular distance between the
centers of two adjacent texels is not constant, nor is the solid angle covered
by a single texel. However, the eye tends to be fairly forgiving, because
the general effect of the reflection is usually more important than the exact
reflection itself. So a lazy way to obtain fuzzy reflections is to just blur the
environment maps uniformly in texture space and hope for the best. Care
still needs to be taken around the edges of the maps, though. For example,
GPUs usually do not automatically filter across cube map faces, so this
needs to be addressed when preparing the reflection map. Figure 6.19 on
page 171 illustrates this issue.
A more physically realistic method is to use a BRDF lobe such as a co-
sine power (Phong) or Gaussian lobe to filter the environment map [866],
accounting for the distortion introduced by the texture representation. See
Figure 8.18. The specular lobe determines which texels on the EM texture
to sample and how much to weight each texel’s relative contribution. Hei-
drich and Seidel [535] use a single reflection map in this way to simulate
the blurriness of a surface.
Imagine some light coming in from near a given reflected view direc-
tion. Light directly from the reflected view direction will give the largest
..................Content has been hidden....................

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