Blender 3D: Noob to Pro/Normals and Shading< Blender 3D: Noob to Pro
|Applicable Blender version: 2.63.|
Open a new Blender document. Delete 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 the Toolshelf visible if it’s not), set both the Segments and Rings to a low number, e.g. 8. The result will be very angular, as shown to the right, not round like you would expect a sphere to be.
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, the blue ones protruding from each vertex are vertex normals.
In the physical theory of light, the normal is a line perpendicular to the surface of the object the light is hitting. 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 the physical characteristics of the surface. 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. The more of those present, the closer the geometry approximates a curve. However, the more there 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 any.
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 the 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. But by adopting a bit of lateral thinking that goes completely against physics, we can often, ironically, come up with much more realistic-looking results.
Not So Smooth?Edit
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 to the right.
Assuming your mesh is constructed properly (e.g. no edges and faces cross each other in physically impossible ways), the most likely reason for this is the normals in the newly added vertices and faces are pointing the wrong way. To fix it, select the troublesome part of the mesh (or select the whole thing) in Edit mode, and press+ to recalculate all the normals. Re-render the scene to confirm the shading discontinuity has disappeared.
Note the different meaning of+ in Edit mode. In all other modes, it opens a new default Blender document!