Reflection mapping 1755151 215549259 2008-05-28T18:16:36Z Tkgd2007 2934677 hdri link [[Image:Spoon fi.jpg|thumb|An example of reflection mapping.]] [[Image:Tj silverteapot stpeters.jpg|thumb|Environment mapping is the foundation for [[image based lighting|image-based lighting]], seen here in this screen shot of [http://www.daionet.gr.jp/~masa/rthdribl/ rthdribl].]] In [[computer graphics]], '''reflection mapping''' is an efficient method of simulating a complex mirroring surface by means of a precomputed texture image. The texture is used to store the image of the environment surrounding the rendered object. There are several ways of storing the surrounding environment; the most common ones are the '''[[Sphere mapping|Spherical Environment Mapping]]''' in which a single texture contains the image of the surrounding as reflected on a mirror ball, or the '''[[Cube mapping|Cubic Environment Mapping]]''' in which the environment is ''unfolded'' onto the six faces of a cube and stored therefore as six square textures. This kind of approach is more efficient than the classical [[ray tracing]] approach of computing the exact reflection by shooting a ray and following its optically exact path, but it should be noted that these are (sometimes crude) approximations of the real reflection. Another important advantage is that it's the only way to create reflections of real-world backgrounds in synthetic objects. A typical drawback of this technique is the absence of self reflections: you cannot see any part of the reflected object inside the reflection itself. == Types of Reflection Mapping == ===Standard Environment Mapping=== '''Spherical environment mapping''' (sometimes known as '''Standard environment mapping'''), 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 [[raytracing|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 [[reflection|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. '''Cube mapping''' (see below) was developed to address this issue. Since cube maps (if made and filtered correctly) have no visible seams, they are an obvious successor to the archaic sphere maps, and nowadays spherical environment maps are almost nonexistent in certain contemporary graphical applications, such as [[video game]] graphics. ===Cube Environment Mapping=== [[Image:cube mapped reflection example.jpg|thumb|A diagram depicting an apparent reflection being provided by cube mapped reflection. The map is actually projected onto the surface from the point of view of the observer. Highlights which in raytracing would be provided by tracing the ray and determining the angle made with the normal, can be 'fudged', if they are manually painted into the texture field (or if they already appear there depending on how the texture map was obtained), from where they will be projected onto the mapped object along with the rest of the texture detail.]] '''Cube mapped reflection''' is a technique that uses [[cube mapping]] to make objects look like they reflect the environment around them. Generally, this is done with the same [[skybox (video games)|skybox]] that is used in outdoor renderings. Although this is not a true reflection since objects around the reflective one will not be seen in the reflection, the desired effect is usually achieved. Cube mapped reflection is done by determining the [[Vector (spatial)|vector]] that the object is being viewed at. This '''camera ray''' is reflected about the [[surface normal]] of where the camera vector intersects the object. This results in the '''reflected ray''' which is then passed to the [[cube map]] to get the [[Texel (graphics)|texel]] which the camera then sees as if it is on the surface of the object. This creates the effect that the object is reflective. ===HEALPix Environment Mapping=== [[HEALPix]] environment mapping, is a technique basically like cube mapping, but it uses a HEALPix map because it preserves better details than a cube map does<ref name="HEALPix">Tien-Tsin Wong, Liang Wan, Chi-Sing Leung, and Ping-Man Lam. [http://appsrv.cse.cuhk.edu.hk/~lwan/paper/sphquadmap/sphquadmap.htm Real-time Environment Mapping with Equal Solid-Angle Spherical Quad-Map], Shader X4: Lighting & Rendering, Charles River Media, 2006</ref>. == History == Precursor work in texture mapping had been established by [[Edwin Catmull]], with refinements for curved surfaces by [[James Blinn]], in 1974. [http://www.comphist.org/computing_history/new_page_6.htm] Blinn went on to further refine his work, developing environment mapping by 1976. [http://www.debevec.org/ReflectionMapping/] [[Gene Miller]] experimented with spherical environment mapping in [[1982]] at [[MAGI Synthavision]]. [http://www.debevec.org/ReflectionMapping/miller.html] With the assistance of Christine Chang, he photographed a Christmas ornament in the parking lot at MAGI. By cropping the photo of the ball down to its diameter, he was able to map it to a hollow sphere (see the process above) ([http://www.debevec.org/ReflectionMapping/Images/08-768.JPG Fig. 1]). Next, he applied it to a blobby dog model created by [[Ken Perlin]] ([http://www.debevec.org/ReflectionMapping/Images/11-768.JPG Fig. 2]), and superimposed the environment-mapped model into a photograph of the parking lot. The result can be seen in [http://www.debevec.org/ReflectionMapping/Images/07-768.JPG Fig. 3]. This technique of environment mapping real-world environments enventually came to use in [[High dynamic range imaging|HDRI]] [[image based lighting|image-based lighting]] (see [http://www.debevec.org/Probes/ here]). Tien-Tsin Wong, Liang Wan, Chi-Sing Leung, and Ping-Man Lam of the Chinese University of Hong Kong experimented with [[HEALPix]] environment mapping<ref name="HEALPix"/>. == Application in Real-Time 3D Graphics == === Standard Environment Mapping === === Cubic Environment Mapping === [[Image:Cube mapped reflection example 2.JPG|thumb|Example of a three-dimensional model using cube mapped reflection]] Cube mapped reflection, when used correctly, may be the fastest method of rendering a reflective surface. To increase the speed of rendering, each vertex calculates the position of the reflected ray. Then, the position is interpolated across polygons to which the vertex is attached. This eliminates the need for recalculating every pixel's reflection. If [[normal mapping]] is used, each polygon has many face normals (the direction a given point on a polygon is facing), which can be used in tandem with an environment map to produce a more realistic reflection. In this case, the angle of reflection at a given point on a polygon will take the normal map into consideration. This technique is used to make an otherwise flat surface appear textured, for example corrugated metal, or brushed aluminium === HEALPix Environment Mapping === [[HEALPix]] mapped reflection, like cube mapping, is the fastest method of rendering a reflective surface when used correctly.{{Fact|date=October 2007}} == See also == * [[Skybox (video games)]] * [[Cube mapping]] * [[Sphere mapping]] == References == {{reflist|2}} == External links == *[http://www.debevec.org/ReflectionMapping/ The Story of Reflection mapping] cured by [[Paul Debevec]] *[http://developer.nvidia.com/attach/6595 NVIDIA's paper] about sphere & cube env. mapping [[Category:3D computer graphics]] [[Category:Demo effects]] [[de:Environment Mapping]] [[zh:反射映射]]