Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Normal mapping
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Calculating tangent spaces== {{Expand section|more math|date=October 2011}} {{Technical|section|date=January 2022}} Surface normals are used in computer graphics primarily for the purposes of lighting, through mimicking a phenomenon called [[specular reflection]]. 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. [[File:Reflection angles.svg|thumb|A graphic depicting how the normal vector determines the reflection of a ray]] 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 (geometry)|normal vectors]], and choosing between these two vectors provides a description on how the surface is [[Orientability|oriented]] at that point, as the light information depends on the angle of incidence between the ray <math>r</math> and the normal vector <math>n</math>, and the light will only be visible if <math>\langle r, n\rangle > 0</math>. In such a case, the reflection <math>s</math> of the ray with direction <math>r</math> along the normal vector <math>n</math> is given by : <math>s = r - 2\langle n, r\rangle n</math> 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]] and the [[Klein bottle]] 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,<ref>{{cite book |last1=Akenine-Möller |first1=Tomas |last2=Haines |first2=Eric |last3=Hoffman |first3=Naty |last4=Pesce |first4=Angelo |last5=Iwanicki |first5=Michał |last6=Hillaire |first6=Sébastien |title=Real-Time Rendering 4th Edition |date=2018 |publisher=A K Peters/CRC Press |location=Boca Raton, FL, USA |isbn=978-1-13862-700-0 |page=57 |edition=4 |url=https://www.realtimerendering.com/ |access-date=2 August 2024}}</ref> 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 (topology)|triangulation]], 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 surface|parametric surfaces]] with tangent spaces, the parametrizations will yield partial derivatives, and these derivatives can be [[Tangent_space#Tangent_vectors_as_directional_derivatives|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.<ref>Mikkelsen, [http://image.diku.dk/projects/media/morten.mikkelsen.08.pdf Simulation of Wrinkled Surfaces Revisited], 2008 '''(PDF)'''</ref> Most often the normal is perturbed in a fragment shader after applying the model and view matrices{{Citation needed|reason=In which implementations or standards is this the case?|date=August 2024}}. Typically the geometry provides a normal and tangent. The tangent is part of the tangent plane and can be transformed simply with the [[Affine transformation|linear]] part of the matrix (the upper 3x3). However, the normal needs to be transformed by the [[Surface_normal#Transforming_normals|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, ''M<sub>3x3</sub>'' be the linear part of model matrix, and ''V<sub>3x3</sub>'' be the linear part of the view matrix. :<math>t' = t \times M_{3x3} \times V_{3x3}</math> :<math>b' = b \times M_{3x3} \times V_{3x3}</math> :<math>n' = n \times (M_{3x3} \times V_{3x3})^{-1T} = n \times M_{3x3}^{-1T} \times V_{3x3}^{-1T}</math> [[File:Rendering with normal mapping.gif|thumb|center|upright=2.0|alt=Rendering with normal mapping.|Rendering using the normal mapping technique. On the left, several solid meshes. On the right, a plane surface with the normal map computed from the meshes on the left.]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)