Guide to Game Development/Theory/Lighting/Light normals

To show how light should interact with the geometry, you should use a light normal vector.

Face normals vs vertex normalsEdit

Left image: Face normals(a), Vertex normals(b). Right image: Vertex normals on a shape with angles less than 90°. Note that the geometry of the image is appearing like a face normal despite the use of vertex normals (replacement for more intuitive image maybe needed).

Face normals (Flat shading/Faceting\Faceted)Edit

This is where you calculate the normal vector of each face and directly apply it onto each of the face's vertices. See a of the left image on the right for an illustration. Face normals are easier to compute and they give a 'retro' look to the geometry.

Vertex normals (Gouraud shading/Phong shading/Smooth shading)Edit

Vertex normals is where you don't just look at one piece of geometry, but all the ones that connect to it. To do this, you first need to calculate a face normal for each piece of geometry, after that, when there is geometry sharing the same point, you need to take the average, you can do this with the following formula:

 , then normalise it:  .

Combined into one mathematical statement looks like:

 

Note: Although this is better mathematically, it's not better computationally, for use with computers, use the first method, it requires the storage of an extra temporary variable, but it it's easier for the processor to handle.

Vertex normals are more computationally intensive than face normals, but they produce a nicer more realistic affect. If you wanted to get a similar affect with face normals, then you would need more polygons, which would be more computationally intensive. One thing you should note from the first image (part b) is that if you have harsh corners like 90° or greater, then it might end up looking worse. As a result, for angles greater than ∼80°, they probably should be shaded using face normals.

External linksEdit

Youtube:

ReferencesEdit