] >
Note: this web page uses MathML, mathematics markup for the web. We have installed mathjax which should render the MathML, But if the maths rendering looks broken, try Firefox, as it has strong MathML support. Chrome/Chromium support is being introduced
A normal vector is a vector perpendicular to a surface, or more mathematically speaking, to a tangent plane.
Normal vectors are used in lighting calculations, and in other rendering effects such as normal and bump mapping. They are also useful for visual debugging.
A flat, i.e. planar polygon only has one normal, which applies to the whole polygon including vertices.
In computer graphics polygon mesh models are often used as approximations of curved surfaces. In that case normals to the actual surface at vertices, i.e. vertex normals are needed, rather than face or polygon normals (see below).
There are situations where polygonal meshes are not approximating curved surfaces, and face normals are appropriate.
A normal to a single polygon or face, i.e. a polygon or face normal can be calculated by taking the cross product of two vectors lying in the same plane as the polygon:
Assume a polygon has vertices:
then vectors A and B can be found as follows
and the polygon normal found as
Equally, other vertices could have been used for calculating
Face normals can be used to find (approximate) vertex normals by calculating and normalising the average of the (normalised) face normals of the faces which meet at the vertex:
For analytically defined surfaces which are differentiable normals can be calculated using differentiation and tangent vectors.
For a 1D curve y=f(x) a tangent vector T to a function y=f(x) is simply
The normal vector and the tangent vector are orthogonal, and so .
From this it can be seen that
(Note that there is also another possible direction )
For analytical 2D surfaces
This equation can be understood as the result of the cross product of two tangent vectors, one in the xy plane and one in the yz plane, both lying in the tangent plane at a point on the surface:
The second tangent vector is sometimes called the binormal, and sometimes the bitangent, but strictly speaking it is not. Also these terms have been mixed up at different times, and are used differently in computer graphics to mathematics.
In the special case of a sphere the normals are trivially found as a vector from the sphere origin to a point on the surface, and normalised by dividing by the radius.
Normals are often supplied as part of model data along with vertex coordinates, face connectivity, colour, textures etc.