Upload
laurence-ferguson
View
215
Download
0
Embed Size (px)
Citation preview
MotivationSilver candlestick No appropriate texture for it “environment” map
Simulates the results of ray-tracing without going through expensive ray-tracing computation
Fall 2013 3
Reflection Mapping (wikipedia)
Standard Environment Mapping in which a single texture contains the image of the surrounding as reflected on a mirror ballCubic Environment Mapping in which the environment is unfolded onto the six faces of a cube and stored therefore as six square textures.
A typical drawback of these techniques is the absence of self reflections: you cannot see any part of the reflected object inside the reflection itself.
Fall 2013 4
Overview1/2
The texture is a set of six 2D images representing the faces of a cube. These targets must be consistent, complete, and have equal width and height.The texture coordinate (s,t,r) can be generated with (1) reflection map, or (2) normal mapThe (s,t,r) texture coordinates are treated as a direction vector emanating from the center of a cube.
Fall 2013 7
Overview2/2
The interpolated per-fragment (s,t,r) selects one cube face 2D image based on the largest magnitude coordinate (the major axis). A new 2D (s,t) is calculated by dividing the two other coordinates (the minor axes values) by the major axis value. Then the new (s,t) is used to lookup into the selected 2D texture image face of the cube map.
Fall 2013 9
Example: (s,t,r)(s,t)
(2,0,1)
Major
sc tc ma
+ry -1 0 2
s = (-1/2 + 1)/2 = ¼t = (0/2 + 1)/2 = ½
st
x
y
z[1/4,1/2]
(s,t,r) need not be normalized!
Fall 2013 10
Two TexGen Modes
REFLECTION_MAP(s,t,r): vertex’s eye-space reflection vector
NORMAL_MAP(s,t,r): vertex’s transformed eye-space normal
Fall 2013 11
Reflection Map [Eye Space]
ne
r
Every vertex (fragment) needs to compute the corresponding reflection vector as tex coord. (more accurate but time consuming)
Fall 2013 12
Normal Map
ne
Use the normal vector (world or eye) to index into the cube map. Quickly get an environment map feel, but not a real reflection.
Fall 2013 13
Other Applications of Cube Maps
Stable specular highlights A better alternative over massive
over tessellation Limited to distant specular lights
Fall 2013 15
Other Applications (cont)
Sky illuminationDynamic cube map reflectionsPer-pixel shading (w/o shader)
Fall 2013 16
Other Environment MapsSphere map (OpenGL) View dependent (different sphere map
required for different eye position) Authoring texture images is non-obvious
(require special image warping)
Fall 2013 18
Spheremap
involves the use of a textured sphere infinitely far away from the object that reflects it. By creating a spherical texture using a fisheye lens or via prerendering or with a light probe, this texture is mapped to a hollow sphere, and the texel colors are determined by calculating the light vectors from the points on the object to the texels in the environment map. This technique may produce results which are superficially similar to those produced by raytracing, but incurs less of a performance hit because all of the colors of the points to be referenced are known beforehand, so all it has to do is to calculate the angles of incidence and reflection.There are a few glaring limitations to spherical mapping. For one thing, due to the nature of the texture used for the map, there is an abrupt point of singularity on the backside of objects using spherical mapping.
Fall 2013 19
Sphere Map (cont)
x 0 1 -1 1 1 -1 0 0 1 0y 0 0 0 1 -1 1 1 -1 0 1z 1 1 1 1 1 1 1 1 0 0xh 0 0.707107 -0.70711 0.57735 0.57735 -0.57735 0 0 1 0yh 0 0 0 0.57735 -0.57735 0.57735 0.707107 -0.70711 0 1zh 1 0.707107 0.707107 0.57735 0.57735 0.57735 0.707107 0.707107 0 0m 2 1.847759 1.847759 1.776148 1.776148 1.776148 1.847759 1.847759 1.414214 1.414214s 0.5 0.691342 0.308658 0.662529 0.662529 0.337471 0.5 0.5 0.853553 0.5t 0.5 0.5 0.5 0.662529 0.337471 0.662529 0.691342 0.308658 0.5 0.853553
(x,y,z): the reflection vector r (in eye coord)
Fall 2013 22