I'm currently studying lighting in OpenGL, which utilizes a function in GLSL called normalize. According to OpenGL docs, it says that it "calculates the normalized product of two vectors". However, it still doesn't explain what "normalized" mean. I have tried look for what a normalized product is on Google, however I can't seem to find anything about it. Can anyone explain what normalizing means and provide a few example of a normalized value?
-
where did you find that? In glsl spec there is: normalize(genType x) - Returns a vector in the same direction as x but with a length of 1. http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf – fen Jul 25 '12 at 07:11
-
Here, I think that was the first thing that came up when I googled it. http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml – TheAmateurProgrammer Jul 25 '12 at 07:14
-
strange... but the the description there is a proper info. – fen Jul 25 '12 at 07:17
-
As a general rule, you should have at least basic knowledge in simple linear algebra when delving into computer graphics, as normalizing a vector will not remain the most complex thing you will encounter very often. – Christian Rau Jul 25 '12 at 07:40
-
I apologize for asking such a simple question as I am just a student going into my sophomore year. I didn't expect that such high level math would be required for graphics programming. – TheAmateurProgrammer Jul 25 '12 at 07:44
-
2Why is this question so downvoted? It's a perfectly valid question which has a perfectly valid answer. – Hannesh Jul 25 '12 at 08:52
-
Because it's a vocabulary lesson. We have http://english.stackexchange.com for that, although they would probably close this question as "general reference." – Robert Harvey Jul 25 '12 at 14:51
-
4This is a valid question. It should be obvious @theAmateurProgrammer has given this some thought but is confused by a lot of writing that assumes you're already familiar with vector-based math. He/she has my sympathy; this isn't a case of somebody asking for someone to send teh codez kthxbye. – benzado Jul 25 '12 at 17:27
-
I recently ran across this question looking for the same answer! All the answers and comments help. I wanted to contribute with this series that really helped me https://www.khanacademy.org/math/linear-algebra/vectors-and-spaces/vectors/v/vector-introduction-linear-algebra – Armeen Moon Feb 07 '17 at 06:28
3 Answers
I think the confusion comes from the idea of normalizing "a value" as opposed to "a vector"; if you just think of a single number as a value, normalization doesn't make any sense. Normalization is only useful when applied to a vector.
A vector is a sequence of numbers; in 3D graphics it is usually a coordinate expressed as v = <x,y,z>
.
Every vector has a magnitude or length, which can be found using Pythagora's theorem: |v| = sqrt(x^2 + y^2 + z^2)
This is basically the length of a line from the origin <0,0,0>
to the point expressed by the vector.
A vector is normal if its length is 1. That's it!
To normalize a vector means to change it so that it points in the same direction (think of that line from the origin) but its length is one.
The main reason we use normal vectors is to represent a direction; for example, if you are modeling a light source that is an infinite distance away, you can't give precise coordinates for it. But you can indicate where to find it from a particular point by using a normal vector.

- 82,288
- 22
- 110
- 138
-
2Normalization does indeed make sense for a single value. That's what sign(x) does. – Jul 25 '12 at 18:16
-
@Jessy Fair enough, but it's a lot less interesting/confusing than the 3-vector case. – benzado Jul 25 '12 at 19:21
-
1Probably. I think it helps to understand the concept, though. For example, I think it's useful to imagine taking the dot product of a normalized "n>1 vector", and a "normalized 1-vector". You can visualize how other dimensions' contributions do not affect the angle between the vectors. Only the dimension that matches the 1-vector matters. – Jul 25 '12 at 23:41
-
2Thanks for the confirmation. When I said value, I basically meant vector, but I wasn't sure if a integer/float could be normalized as well so the term value was suppose to represent both vector and integer & floats. – TheAmateurProgrammer Jul 26 '12 at 01:57
It's a mathematical term and this link explains its meaning in quite simple terms:
Operations in 2D and 3D computer graphics are often performed using copies of vectors that have been normalized ie. converted to unit vectors... Normalizing a vector involves two steps:
- calculate its length, then,
- divide each of its (
xy
orxyz
) components by its length...
It's something complicated to explain if you don't know too much about vectors or even vectorial algebra. (You can check this article about general concepts as vector, normal vector or even normalization procedure ) Check it
But the procedure or concept of "normalize" refers to the process of making something standard or “normal.”
In the case of vectors, let’s assume for the moment that a standard vector has a length of 1. To normalize a vector, therefore, is to take a vector of any length and, keeping it pointing in the same direction, change its length to 1, turning it into what is called a unit vector.

- 26
- 1