Normalizing Vectors and Light in Computer Graphics

Click For Summary
SUMMARY

This discussion focuses on the normalization of vectors and the concept of vertex normals in computer graphics, particularly within the context of OpenGL 3+. Normalizing a vector involves rescaling it to a unit length by dividing each component by the vector's length. Vertex normals, essential for accurate lighting calculations, are derived from the surface normals at specific points on geometry, such as Bezier surfaces or NURBS. The process of lighting in rendering applications utilizes dot products between normal maps and light direction vectors to create lightmaps, which are then modulated with texture maps for realistic rendering.

PREREQUISITES
  • Understanding of OpenGL 3+ rendering techniques
  • Familiarity with vector mathematics, including normalization and dot products
  • Knowledge of normal maps and their role in lighting
  • Basic calculus for computing vertex normals from parametric surfaces
NEXT STEPS
  • Learn about OpenGL 3+ lighting models and their implementation
  • Study vector normalization techniques in computer graphics
  • Explore the creation and use of normal maps in texture mapping
  • Investigate calculus applications for computing vertex normals on various surface types
USEFUL FOR

Graphics programmers, game developers, and anyone involved in 3D rendering who seeks to enhance their understanding of lighting calculations and vector mathematics in computer graphics.

Shadow_7
Messages
5
Reaction score
0
I am trying to understand how light works in computer graphics. Especially OpenGL 3+. So I was given a paper that says how to calculate light. It says "normalise the vectors
before taking the dot product".How do I normalize vectors and why? I have to compute the normals to a vertex. What is a normal to a vertex? How can I visualise it?
 
Technology news on Phys.org
"Normalising a vector" just means rescaling it (i.e. multiply by a scalar) so that the vector's length becomes 1.

I don't understand what "normal to a vertex" could mean. Was that really the language that was used?
 
Shadow_7 said:
I am trying to understand how light works in computer graphics. Especially OpenGL 3+. So I was given a paper that says how to calculate light. It says "normalise the vectors
before taking the dot product".How do I normalize vectors and why? I have to compute the normals to a vertex. What is a normal to a vertex? How can I visualise it?

As stated, normalizing vectors means making their length 1. You just divide each component by the length of the vector, and that will give you a unit vector.

In rendering applications, if your texture is RGBA 32-bit, each component of the vector will have 8 bits. This means that the representation will consist of 3 signed 8-bit numbers corresponding to your vector.

Typically when you use the dot product texture operator, you have a texture map which is known as the normal map. When you take the dot product of the normal map with the light normal vector, you get a lightmap for your object which you modulate with your texture map which gives you a texture that shows the effect of a light on that object.

So basically: light direction vector -> texture. From there you use dot product between this texture map and normal map: This will give you a lightmap which you modulate with normal texture map which gives modulated map. You then modulate that usually with another lightmap which gives final texture for object which you use for rendering.

You can do more than this but this is the general idea.

The thing is that this method assumes a directional light source: your lighting source is like say the sun and not something like a lamp or a flashlight: you add more texture operations for this kind of effect.

The normal to a vertex (or vertex normal) is the normal at a point of your geometry.

As an example if you have a parametric surface (Bezier surface), the vertex normal is just the surface normal at that point.

Vertex normals are used for lighting as well, and under the old rendering pipeline, this is how lighting was actually done. It is done in the same sort of way that the normal map does it, but it's done in the vertex pipeline, whereas the normal map computations are done in the fragment (or texture) pipeline.

If you want to visualize a vertex normal, just draw a line of the vertex normal from the point to another short point in the direction of the normal.

In terms of getting the vertex normal, for surfaces like Bezier surfaces or NURBS, you need to use calculus. Essentially you get the tangent and binormal vectors and then take the cross product and normalize the vector.

For straight surfaces it is a little trickier. You have to take into account adjoining edges since these objects are not continuous in the way that parametric surfaces are. You usually average over the normal vectors of adjoining surfaces.
 

Similar threads

Replies
15
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
48
Views
5K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
29
Views
6K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
990
Replies
3
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K