How Dot Product and Cross Product Are Used in Video Games

TIME : 2016-01-07
How Dot Product and Cross Product Are Used in Video Games

Both the dot product and cross product play important roles behind the scenes in 3D video games.

The cross product is used to calculate the surface normals of triangles, which are the building blocks of 3D objects. Those normals can then be tested against the camera using the dot product. If the dot product angle is positive, the surface faces the same direction as the camera and the triangle can be skipped since it is not visible. If the angle is negative, the vectors point toward each other and the triangle likely needs to be rendered.

These techniques are not just for camera visibility. They also power lighting calculations and physics simulations, making them fundamental tools in game development.