Blender 3D: Noob to Pro/Normals and Shading
|Applicable Blender version: 2.63.|
Open a new Blender document. Get rid of the default cube, and add a “UV Sphere” mesh. In the “Add UV Sphere” panel which appears at the lower left of the Toolshelf (pressto make it visible at the left side of the 3D view if it’s not), set the Segments and Rings both to a low number like 8. The result will be very angular, as at right—not round like you would expect a sphere to be at all.
As you can see, the surfaces of the object look a lot smoother and curved, even though the outline or silhouette is just as angular as before.
Those spiky little lines are the normals; the green ones in the middle of each face are face normals, while the blue ones sticking out of each vertex are vertex normals.
In the physical theory of how light works, the normal is the perpendicular to the surface of the object that the light hits. When your eye (or the camera) C is positioned on a plane through the normal of a particular surface observing a certain surface point P illuminated by a coplanar light source L, a specific amount of light will be reflected and hence be registered by the camera depending on physical characteristics of the surface. Basically, the observed intensity of reflected light is at a maximum if the angle C-P-L is divided into two equal halves by the normal.
In the real world, a lot of surfaces are curved or otherwise not flat. But a mesh can only be made up of straight edges and flat faces. So how can it represent an object with a curved surface?
When you added the UV sphere to your scene, you had the option of specifying how many segments and rings it was made from. And the more of these there are, the closer the geometry can approximate to a curve. However, the more of these are, the longer the render will take, and the more memory the model will consume to hold information about all the extra vertices, edges and faces.
Which is where that “Smooth” shading button you clicked comes in. It applies a trick called Phong shading: instead of doing the lighting calculation based on a normal for each face as the physical theory says you should, it starts with a normal assigned to each vertex, and interpolates the normal at each point on a face from the vertex normals at its corners, based on the distance at that point to those corners. The result fools the eye into seeing curved, rounded surfaces where there aren’t actually any.
Now, this completely violates the laws of physics. To start with, how can you define a “normal” which is perpendicular to a point? But as you can see, the results look rather good, with relatively little extra computation involved—much less than actually generating all that extra geometry.
As you learn more about computer graphics, you will come across more tricks like this. Physically-accurate modelling is still very difficult to do, even with modern computers, and the results may not look all that good anyway; but by adopting a bit of lateral thinking that goes completely against how physics actually works, we can often, ironically, come up with much more realistic-looking results.
Not So Smooth?
If you have been adding lots of vertices, edges and faces to your mesh, you may end up with discontinuities in smooth shading causing unsightly blotches, as shown at right.
Assuming your mesh is constructed properly (e.g. you don’t have edges and faces crossing each other in physically-impossible ways), the most likely reason for this is that the normals in the newly-added vertices and faces are pointing the wrong way. To fix this, select the troublesome part of the mesh (or just select the whole thing) in Edit mode, and press+ to recalculate all the normals. Now try a fresh render, to confirm that the shading discontinuity has disappeared.
Note the different meaning of+ in Edit mode; in all other modes, it opens a new default Blender document!