| |||||
Vectors contain both magnitude (length) and direction. However, in some cases it's useful to separate one from the other. You may want to know just the length, or you may want to work with the direction as a normalized unit vector -a vector with a length of one, but the same direction. To compute the magnitude of a vector, simply apply the Pythagorean theorem.
Once you compute the magnitude, the normalized unit vector can be found by dividing each component by the magnitude.
Most surface normal vectors should be normalized to ensure that lighting calculations yield the correct results.
| |||||