HOME

TheInfoList



OR:

In
3D computer graphics 3D computer graphics, sometimes called Computer-generated imagery, CGI, 3D-CGI or three-dimensional Computer-generated imagery, computer graphics, are graphics that use a three-dimensional representation of geometric data (often Cartesian coor ...
, normal mapping, or Dot3 bump mapping, is a
texture mapping Texture mapping is a term used in computer graphics to describe how 2D images are projected onto 3D models. The most common variant is the UV unwrap, which can be described as an inverse paper cutout, where the surfaces of a 3D model are cut ap ...
technique used for faking the lighting of bumps and dents – an implementation of bump mapping. It is used to add details without using more
polygon In geometry, a polygon () is a plane figure made up of line segments connected to form a closed polygonal chain. The segments of a closed polygonal chain are called its '' edges'' or ''sides''. The points where two edges meet are the polygon ...
s. A common use of this technique is to greatly enhance the appearance and details of a low polygon model by generating a normal map from a high polygon model or height map. Normal maps are commonly stored as regular RGB images where the RGB components correspond to the X, Y, and Z coordinates, respectively, of 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 ...
.


History

In 1978 Jim Blinn described how the normals of a surface could be perturbed to make geometrically flat faces have a detailed appearance. The idea of taking geometric details from a high polygon model was introduced in "Fitting Smooth Surfaces to Dense Polygon Meshes" by Krishnamurthy and Levoy, Proc.
SIGGRAPH SIGGRAPH (Special Interest Group on Computer Graphics and Interactive Techniques) is an annual conference centered around computer graphics organized by ACM, starting in 1974 in Boulder, CO. The main conference has always been held in North ...
1996, where this approach was used for creating displacement maps over
nurbs Non-uniform rational basis spline (NURBS) is a mathematical model using basis splines (B-splines) that is commonly used in computer graphics for representing curves and surfaces. It offers great flexibility and precision for handling both analy ...
. In 1998, two papers were presented with key ideas for transferring details with normal maps from high to low polygon meshes: "Appearance Preserving Simplification", by Cohen et al. SIGGRAPH 1998, and "A general method for preserving attribute values on simplified meshes" by Cignoni et al. IEEE Visualization '98. The former introduced the idea of storing surface normals directly in a texture, rather than displacements, though it required the low-detail model to be generated by a particular constrained simplification algorithm. The latter presented a simpler approach that decouples the high and low polygonal mesh and allows the recreation of any attributes of the high-detail model (color, texture coordinates, displacements, etc.) in a way that is not dependent on how the low-detail model was created. The combination of storing normals in a texture, with the more general creation process is still used by most currently available tools.


Spaces

The orientation of coordinate axes differs depending on the space in which the normal map was encoded. A straightforward implementation encodes normals in object space so that the red, green, and blue components correspond directly with the X, Y, and Z coordinates. In object space, the coordinate system is constant. However, object-space normal maps cannot be easily reused on multiple models, as the orientation of the surfaces differs. Since color texture maps can be reused freely, and normal maps tend to correspond with a particular texture map, it is desirable for artists that normal maps have the same property. Normal map reuse is made possible by encoding maps in
tangent space In mathematics, the tangent space of a manifold is a generalization of to curves in two-dimensional space and to surfaces in three-dimensional space in higher dimensions. In the context of physics the tangent space to a manifold at a point can be ...
. The tangent space is a vector space, which is tangent to the model's surface. The coordinate system varies smoothly (based on the derivatives of position with respect to texture coordinates) across the surface. Tangent space normal maps can be identified by their dominant purple color, corresponding to a vector facing directly out from the surface. See Calculation.


Calculating tangent spaces

Surface normals are used in computer graphics primarily for the purposes of lighting, through mimicking a phenomenon called
specular reflection Specular reflection, or regular reflection, is the mirror-like reflection (physics), reflection of waves, such as light, from a surface. The law of reflection states that a reflected ray (optics), ray of light emerges from the reflecting surf ...
. Since the visible image of an object is the light bouncing off of its surface, the light information obtained from each point of the surface can instead be computed on its tangent space at that point. For each tangent space of a surface in 3-dimensional space, there are two vectors which are perpendicular to every vector of the tangent space. These vectors are called normal vectors, and choosing between these two vectors provides a description on how the surface is oriented at that point, as the light information depends on the angle of incidence between the ray r and the normal vector n, and the light will only be visible if \langle r, n\rangle > 0. In such a case, the reflection s of the ray with direction r along the normal vector n is given by : s = r - 2\langle n, r\rangle n Intuitively, this just means that you can only see the outward face of an object if you're looking from the outside, and only see the inward face if you're looking from the inside. Note that the light information is local, and so the surface does not necessarily need to be orientable as a whole. This is why even though spaces such as the
Möbius strip In mathematics, a Möbius strip, Möbius band, or Möbius loop is a Surface (topology), surface that can be formed by attaching the ends of a strip of paper together with a half-twist. As a mathematical object, it was discovered by Johann Bened ...
and the
Klein bottle In mathematics, the Klein bottle () is an example of a Orientability, non-orientable Surface (topology), surface; that is, informally, a one-sided surface which, if traveled upon, could be followed back to the point of origin while flipping the ...
are non-orientable, it is still possible to visualize them. Normals can be specified with a variety of coordinate systems. In computer graphics, it is useful to compute normals relative to the tangent plane of the surface. This is useful because surfaces in applications undergo a variety of transforms, such as in the process of being rendered, or in skeletal animations, and so it is important for the normal vector information to be preserved under these transformations. Examples of such transforms include transformation, rotation, shearing and scaling, perspective projection, or the skeletal animations on a finely detailed character. For the purposes of computer graphics, the most common representation of a surface is a
triangulation In trigonometry and geometry, triangulation is the process of determining the location of a point by forming triangles to the point from known points. Applications In surveying Specifically in surveying, triangulation involves only angle m ...
, and as a result, the tangent plane at a point can be obtained through interpolating between the planes that contain the triangles that each intersect that point. Similarly, for parametric surfaces with tangent spaces, the parametrizations will yield partial derivatives, and these derivatives can be used as a basis of the tangent spaces at every point. In order to find the perturbation in the normal the tangent space must be correctly calculated. Most often the normal is perturbed in a fragment shader after applying the model and view matrices. Typically the geometry provides a normal and tangent. The tangent is part of the tangent plane and can be transformed simply with the
linear In mathematics, the term ''linear'' is used in two distinct senses for two different properties: * linearity of a '' function'' (or '' mapping''); * linearity of a '' polynomial''. An example of a linear function is the function defined by f(x) ...
part of the matrix (the upper 3x3). However, the normal needs to be transformed by the inverse transpose. Most applications will want bitangent to match the transformed geometry (and associated UVs). So instead of enforcing the bitangent to be perpendicular to the tangent, it is generally preferable to transform the bitangent just like the tangent. Let ''t'' be tangent, ''b'' be bitangent, ''n'' be normal, ''M3x3'' be the linear part of model matrix, and ''V3x3'' be the linear part of the view matrix. :t' = t \times M_ \times V_ :b' = b \times M_ \times V_ :n' = n \times (M_ \times V_)^ = n \times M_^ \times V_^


Calculation

To calculate the Lambertian (diffuse) lighting of a surface, the unit
vector Vector most often refers to: * Euclidean vector, a quantity with a magnitude and a direction * Disease vector, an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematics a ...
from the shading point to the light source is dotted with the unit vector normal to that surface, and the result is the intensity of the light on that surface. Imagine a polygonal model of a sphere - you can only approximate the shape of the surface. By using a 3-channel bitmap textured across the model, more detailed normal vector information can be encoded. Each channel in the bitmap corresponds to a spatial dimension (X, Y and Z). These spatial dimensions are relative to a constant coordinate system for object-space normal maps, or to a smoothly varying coordinate system (based on the derivatives of position with respect to texture coordinates) in the case of tangent-space normal maps. This adds much more detail to the surface of a model, especially in conjunction with advanced lighting techniques. Unit Normal vectors corresponding to the u,v texture coordinate are mapped onto normal maps. Only vectors pointing towards the viewer (z: 0 to -1 for Left Handed Orientation) are present, since the vectors on geometries pointing away from the viewer are never shown. The mapping is as follows: X: -1 to +1 : Red: 0 to 255 Y: -1 to +1 : Green: 0 to 255 Z: 0 to -1 : Blue: 128 to 255 light green light yellow dark cyan light blue light red dark blue dark magenta * A normal pointing directly towards the viewer (0,0,-1) is mapped to (128,128,255). Hence the parts of object directly facing the viewer are light blue. The most common color in a normal map. * A normal pointing to top right corner of the texture (1,1,0) is mapped to (255,255,128). Hence the top-right corner of an object is usually light yellow. The brightest part of a color map. * A normal pointing to right of the texture (1,0,0) is mapped to (255,128,128). Hence the right edge of an object is usually light red. * A normal pointing to top of the texture (0,1,0) is mapped to (128,255,128). Hence the top edge of an object is usually light green. * A normal pointing to left of the texture (-1,0,0) is mapped to (0,128,128). Hence the left edge of an object is usually dark cyan. * A normal pointing to bottom of the texture (0,-1,0) is mapped to (128,0,128). Hence the bottom edge of an object is usually dark magenta. * A normal pointing to bottom left corner of the texture (-1,-1,0) is mapped to (0,0,128). Hence the bottom-left corner of an object is usually dark blue. The darkest part of a color map. Since a normal will be used in the
dot product In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a Scalar (mathematics), scalar as a result". It is also used for other symmetric bilinear forms, for example in a pseudo-Euclidean space. N ...
calculation for the diffuse lighting computation, we can see that the would be remapped to the values, giving that kind of sky blue color seen in normal maps (blue (z) coordinate is perspective (deepness) coordinate and RG-xy flat coordinates on screen). would be remapped to the (/2+)*255=*255=*255= values (0.3^2+0.4^2+(-0.866)^2=1). The sign of the z-coordinate (blue channel) must be flipped to match the normal map's normal vector with that of the eye (the viewpoint or camera) or the light vector. Since negative z values mean that the vertex is in front of the camera (rather than behind the camera) this convention guarantees that the surface shines with maximum strength precisely when the light vector and normal vector are coincident.


Normal mapping in video games

Interactive normal map rendering was originally only possible on PixelFlow, a parallel rendering machine built at the
University of North Carolina at Chapel Hill The University of North Carolina at Chapel Hill (UNC, UNC–Chapel Hill, or simply Carolina) is a public university, public research university in Chapel Hill, North Carolina, United States. Chartered in 1789, the university first began enrolli ...
. It was later possible to perform normal mapping on high-end SGI workstations using multi-pass rendering and
framebuffer A framebuffer (frame buffer, or sometimes framestore) is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing data representing all the pixels in a complete video frame. Mode ...
operations or on low end PC hardware with some tricks using paletted textures. However, with the advent of
shader In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as '' shading''. Shaders have evolved to perform a variety of s ...
s in personal computers and game consoles, normal mapping became widespread in the early 2000s, with some of the first games to implement it being Evolva (2000), Giants: Citizen Kabuto, and Virtua Fighter 4 (2001). Normal mapping's popularity for real-time rendering is due to its good quality to processing requirements ratio versus other methods of producing similar effects. Much of this efficiency is made possible by distance-indexed detail scaling, a technique which selectively decreases the detail of the normal map of a given texture (cf. mipmapping), meaning that more distant surfaces require less complex lighting simulation. Many authoring pipelines use high resolution models
baked Baking is a method of preparing food that uses dry heat, typically in an oven, but it can also be done in hot ashes, or on hot stones. Bread is the most commonly baked item, but many other types of food can also be baked. Heat is gradually t ...
into low/medium resolution in-game models augmented with normal maps. Basic normal mapping can be implemented in any hardware that supports palettized textures. The first game console to have specialized normal mapping hardware was the Sega
Dreamcast The is the final home video game console manufactured by Sega. It was released in Japan on November 27, 1998, in North America on September 9, 1999 and in Europe on October 14, 1999. It was the first sixth-generation video game console, prec ...
. However, Microsoft's
Xbox Xbox is a video gaming brand that consists of four main home video game console lines, as well as application software, applications (games), the streaming media, streaming service Xbox Cloud Gaming, and online services such as the Xbox networ ...
was the first console to widely use the effect in retail games. Out of the sixth generation consoles, only the
PlayStation 2 The PlayStation 2 (PS2) is a home video game console developed and marketed by Sony Interactive Entertainment, Sony Computer Entertainment. It was first released in Japan on 4 March 2000, in North America on 26 October, in Europe on 24 Novembe ...
's GPU lacks built-in normal mapping support, though it can be simulated using the PlayStation 2 hardware's vector units. Games for the
Xbox 360 The Xbox 360 is a home video game console developed by Microsoft. As the successor to the Xbox (console), original Xbox, it is the second console in the Xbox#Consoles, Xbox series. It was officially unveiled on MTV on May 12, 2005, with detail ...
and the
PlayStation 3 The PlayStation 3 (PS3) is a home video game console developed and marketed by Sony Computer Entertainment (SCE). It is the successor to the PlayStation 2, and both are part of the PlayStation brand of consoles. The PS3 was first released on ...
rely heavily on normal mapping and were the first game console generation to make use of parallax mapping. The
Nintendo 3DS The is a foldable dual-screen handheld game console produced by Nintendo. Announced in March 2010 as the successor to the Nintendo DS, the console was released originally on February 26, 2011 and went through various revisions in its lifetime, ...
has been shown to support normal mapping, as demonstrated by '' Resident Evil: Revelations'' and '' Metal Gear Solid 3: Snake Eater''.


See also

*
Reflection (physics) Reflection is the change in direction of a wavefront at an interface between two different media so that the wavefront returns into the medium from which it originated. Common examples include the reflection of light, sound and water waves. The ...
*
Ambient occlusion In 3D computer graphics, modeling, and animation, ambient occlusion is a shading and rendering technique used to calculate how exposed each point in a scene is to ambient lighting. For example, the interior of a tube is typically more occlude ...
*
Depth map In 3D computer graphics and computer vision, a depth map is an Digital image, image or Channel (digital image), image channel that contains information relating to the distance of the Computer representation of surfaces, surfaces of scene objec ...
* Baking (computer graphics) *
Tessellation (computer graphics) In computer graphics, tessellation is the dividing of datasets of polygons (sometimes called ''vertex sets'') presenting objects in a scene into suitable structures for Rendering (computer graphics), rendering. Especially for Real-time computer ...
* Bump mapping * Displacement mapping


References


External links


Normal Map Tutorial
Per-pixel logic behind Dot3 Normal Mapping
NormalMap-Online
Free Generator inside Browser *



using old OpenGL extensions.

Creating normal maps manually by layering digital photographs


Simple Normal Mapper
Open Source normal map generator {{Texture mapping techniques Texture mapping Virtual reality