Download presentation
Presentation is loading. Please wait.
Published byLaurence Ferguson Modified over 9 years ago
1
Environment Mapping
2
Examples Fall 20132
3
Motivation Silver candlestick No appropriate texture for it “ environment ” map Simulates the results of ray-tracing without going through expensive ray-tracing computation Fall 20133
4
Reflection Mapping (wikipedia) Standard Environment Mapping in which a single texture contains the image of the surrounding as reflected on a mirror ball Cubic 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 20134
5
What’s available in OpenGL SphereMapCubemap Fall 20135
6
Cube Map Encode the environment with a cube map Fall 20136
7
Overview 1/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 map The (s,t,r) texture coordinates are treated as a direction vector emanating from the center of a cube. Fall 20137
8
8
9
Overview 2/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 20139
10
Example: (s,t,r) (s,t) (2,0,1) Majorsctcma +ry02 s = (-1/2 + 1)/2 = ¼ t = (0/2 + 1)/2 = ½ s t x y z [1/4,1/2] (s,t,r) need not be normalized! Fall 201310
11
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 201311
12
Reflection Map [Eye Space] nene r Every vertex (fragment) needs to compute the corresponding reflection vector as tex coord. (more accurate but time consuming) Fall 201312
13
Normal Map nene 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 201313
14
Cubemap Textures (ref)ref Debug Snow Red sky Fall 201314
15
Other Applications of Cube Maps Stable specular highlights A better alternative over massive over tessellation Limited to distant specular lights Fall 201315
16
Other Applications (cont) Sky illumination Dynamic cube map reflections Per-pixel shading (w/o shader) Fall 201316
17
Front face color Debug Cubemap Settings Fall 201317
18
Other Environment Maps Sphere map (OpenGL) View dependent (different sphere map required for different eye position) Authoring texture images is non-obvious (require special image warping) Fall 201318
19
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 201319
20
Sphere Map (from Spec) Fall 201320
21
Sphere Map Fall 201321
22
Sphere Map (cont) (x,y,z): the reflection vector r (in eye coord) Fall 201322
23
GLSL Implementation Fall 201323
24
Generating Sphere Map Fisheye lens Fall 201324
25
FishEye PS: Filter/distort/spherize Fisheye lens/camera Cheap fisheye Fall 201325
26
Add Specular with Sphere Map Fall 201326
27
Adding Silhouettes with Sphere Map Fall 201327
28
[bug?!] Somehow, the results from ShaderMaker is wrong!? The result from OpenGL & glsl is correct Fall 201328
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.