Open main menu

Wikibooks β

Blender 3D: Noob to Pro/Normals and Shading

< Blender 3D: Noob to Pro
Blender263LowPolyUVSphere.png

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 (press  T  to 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.

Blender263LowPolyUVSphereFlat.png

Press  F12  to do a quick render. The 3D view will be replaced with the UV/Image Editor Blender269UVImageEditorIcon.png view, showing the rendered image, as at right. Press  F11  to return to the 3D view Blender2693DViewIcon.png.

Blender263LowPolyUVSphereSmooth.png

Select the sphere object ( RMB ). Now look in the Toolshelf for the shading buttons: Blender263ShadingButtons.png, and click on “Smooth”. Now try a new render with  F12 .

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.

Blender263LowPolyUVSphereNormals.png

Return to the 3D view with  F11 . Ensure the UV sphere object is selected, and you are in Edit mode. Bring up the Properties shelf at the right side of the 3D view with  N  if it’s not already visible. Look for the Mesh Display panel, and find the settings for Normals. Blender263MeshDisplayNormalsSettings.png. If you check both icon boxes, the display of the UV sphere should change to look something like the image to the right.

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  CTRL + N  to recalculate all the normals. Re-render the scene to confirm the shading discontinuity has disappeared.

 

Note the different meaning of  CTRL + N  in Edit mode. In all other modes, it opens a new default Blender document!