In
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
, sphere mapping (or spherical environment mapping) is a type of
reflection mapping
In computer graphics, reflection mapping or environment mapping is an efficient image-based lighting technique for approximating the appearance of a reflective surface by means of a precomputed texture. The texture is used to store the image o ...
that approximates reflective surfaces by considering the environment to be an infinitely far-away spherical wall. This environment is stored as a texture depicting what a mirrored sphere would look like if it were placed into the environment, using an
orthographic projection
Orthographic projection (also orthogonal projection and analemma) is a means of representing Three-dimensional space, three-dimensional objects in Plane (mathematics), two dimensions. Orthographic projection is a form of parallel projection in ...
(as opposed to one with
perspective). This texture contains reflective data for the entire environment, except for the spot directly behind the sphere. (For one example of such an object, see Escher's drawing
Hand with Reflecting Sphere.)
To use this data, the
surface normal
In geometry, a normal is an object (e.g. a line, ray, or vector) that is perpendicular to a given object. For example, the normal line to a plane curve at a given point is the infinite straight line perpendicular to the tangent line to the ...
of the object, view direction from the object to the camera, and/or reflected direction from the object to the environment is used to calculate a texture coordinate to look up in the aforementioned texture map. The result appears like the environment is reflected in the surface of the object that is being rendered.
Usage example
In the simplest case for generating texture coordinates, suppose:
* The map has been created as above, looking at the sphere along the z-axis.
* The texture coordinate of the center of the map is (0,0), and the sphere's image has radius 1.
* We are rendering an image in the same exact situation as the sphere, but the sphere has been replaced with a reflective object.
* The image being created is orthographic, or the viewer is infinitely far away, so that the view direction does not change as one moves across the image.
At texture coordinate
, note that the depicted location on the sphere is
(where ''z'' is
), and the normal at that location is also
. However, we are given the reverse task (a normal for which we need to produce a texture map coordinate). So the texture coordinate corresponding to normal
is
.
See also
*
Skybox (video games)
*
HEALPix
HEALPix (sometimes written as Healpix), an acronym for Hierarchical Equal Area isoLatitude Pixelisation of a 2-sphere, is an algorithm for pixelisation of the 2-sphere based on subdivision of a distorted rhombic dodecahedron, and the associate ...
, mapping with little distortion, arbitrary precision, and equal-sized fragments
Texture mapping
{{compu-graphics-stub