• Surface normal plays a key role in computer graphics.
  • Given a triangle <p1p_{1}, p2p_{2}, p3p_{3}>, let v1v_{1} denote the vector connecting the first vertex (p1p_{1}) and the second (p2p_{2}). Similarly, the vector connecting the first vertex (p1p_{1}) and the third (p3p_{3}) is denoted by (v2v_{2}). Then, the triangle normal is computed using the cross product based on the right-hand rule.
Pasted image 20240220145918

v1×v2∣∣v1×v2∣∣\frac{v_{1} \times v_{2}}{||v_{1} \times v_{2}||} where ×\times denotes the cross product operation.

  • When v1v_{1} and v2v_{2} are represented in (x1y1z1x_{1} \hspace{1mm} y_{1} \hspace{1mm} z_{1}) and (x2y2z2x_{2} \hspace{1mm} y_{2}\hspace{1mm} z_{2}), respectively, v1×v2v_{1} \times v_{2} is defined as y1z2−z1y2z1x2−x1z2x1y2−y1x2y_{1}z_{2}-z_{1}y_{2} \hspace{1mm} z_{1}x_{2} - x_{1}z_{2} \hspace{1mm} x_{1}y_{2} - y_{1}x_{2}
  • Every normal vector is made to be a unit vector by default.
  • Note that p1p_{1}, p2p_{2}, and p3p_{3} are ordered counter-clockwise (CCW).

  • Vertex normal should approximate the normal of the smooth surface at the vertex position.
  • A vertex normal is usually computed by averaging the normals of all polygons sharing the vertex.

  • In computer graphics, surface normals are supposed to point out of the polyhedron. For this, we need CCW ordering of the vertices, i.e, <p1p_{1}, p2p_{2}, p3p_{3}>, instead of <p1p_{1}, p3p_{3}, p2p_{2}>
  • In the index buffer, the vertices are ordered CCW.
Pasted image 20240220160943
Built with LogoFlowershow