Sub topic 8
Controlling Shading with Sharp Edges and Smooth Shading
This chapter assumes you can move between Object Mode and Edit Mode, select edges and faces, and use the Bevel modifier from the previous chapter. You do not need to know how normals are calculated. This chapter explains that.
By the end you will know why a hard-surface prop shows dark smears or faceted patches, and how to fix it with smooth shading, sharp edges and a bevel angle limit.
What Shading Actually Does
A mesh is made of flat faces. Shading is how the renderer decides to colour the surface across each face. It does this with normals. A normal is a direction vector that points away from the surface. Lighting is calculated from the angle between the light and the normal.
Blender stores two kinds of normals you need to tell apart:
- A face normal points straight out of a face. It is the same everywhere on that face.
- A vertex normal (also called a corner normal or split normal) belongs to a vertex of a face. It is used to shade the face when smooth shading is on.
With flat shading, each face uses its face normal. Every face has one uniform colour, so you see the facets. With smooth shading, Blender blends the normals across the face from vertex to vertex. A curved surface then looks continuous.
The problem on a hard-surface prop is that you want both looks at once. Large panels must stay crisp and flat. Bevelled corners and cylinders must look round. The tools in this chapter let you mix the two on a single object.
Flat Versus Smooth Shading
Select the object in Object Mode. In the 3D Viewport header choose Object > Shade Smooth or Object > Shade Flat. In Edit Mode the same commands appear in the Face menu and apply only to the selected faces.
You can do the same from Python:
import bpy
obj = bpy.context.active_object
# Smooth-shade every face of the active mesh
for poly in obj.data.polygons:
poly.use_smooth = True
obj.data.update()If you run this on a freshly blocked-out prop, you will see the first problem at once. Every flat face now looks bent. A box with Shade Smooth shows gradients across its sides, because the corner normals are averaged between neighbouring faces that meet at 90 degrees. This is correct maths and the wrong look.
You have two ways to fix it. You can add enough geometry for the shading to behave (bevels), and you can tell Blender which edges must stay hard (sharp edges). Hard-surface work normally uses both.
Marking Sharp Edges
A sharp edge is an edge that Blender treats as a hard boundary for normals. Normals are not blended across it, even when the faces are smooth shaded.
To mark one:
- Enter Edit Mode and switch to edge select mode (press
2). - Select the edges that should stay crisp.
- Choose Edge > Mark Sharp.
To remove the mark, choose Edge > Clear Sharp. Marked edges are drawn in cyan in the viewport.
You can also select edges by angle. Choose Select > Select Sharp Edges to select every edge whose face angle exceeds a threshold, 30 degrees by default. Then use Mark Sharp. This is a fast way to protect all the hard corners of a blocked-out shape.
import math
import bpy
import bmesh
obj = bpy.context.edit_object
bm = bmesh.from_edit_mesh(obj.data)
limit = math.radians(30.0)
for edge in bm.edges:
# Only edges shared by exactly two faces have a face angle
if len(edge.link_faces) == 2:
if edge.calc_face_angle() > limit:
edge.smooth = False # False means "sharp"
bmesh.update_edit_mesh(obj.data)In BMesh the smooth flag on an edge is the inverse of the sharp mark. Setting edge.smooth = False is the same as Mark Sharp.
Blender 4.1 and Later
Older versions of Blender had an Auto Smooth checkbox in the Object Data properties. It split normals for you above an angle. Blender 4.1 removed that checkbox. In 4.1 and later, Shade Smooth is replaced in practice by two options in the Object menu:
- Shade Auto Smooth smooths faces but keeps edges sharp above an angle you choose. Its default is 30 degrees.
- Shade Smooth by Angle is the same operation under a clearer name in recent versions.
Both options mark edges sharp based on the angle and then shade smooth. They also add a modifier node group in some workflows, so check your modifier stack if you see an extra entry. If you follow older tutorials, remember that the Auto Smooth checkbox no longer exists in your version.
Why Bevels Make Smooth Shading Work
Sharp marks alone give crisp edges, but real hard-surface parts have a small rounded edge that catches light. The Bevel modifier from the previous chapter creates this. It also gives smooth shading the geometry it needs.
Consider a 90 degree corner. With no bevel, smooth shading averages the normals across the corner and ruins both faces. With a bevel of three segments, the corner is made of several narrow faces. Each narrow face has a normal that turns a little from the last, so the highlight rolls around the corner. The large flat faces on each side keep their normals, because the bevel gives them no neighbour at a large angle.
This is why the Bevel modifier in the earlier chapter used a 30 degree angle limit. It bevels only the hard edges. The angle limit and the shading angle should agree. If the bevel catches edges at 30 degrees, shade smooth by angle at 30 degrees too.
import math
import bpy
obj = bpy.context.active_object
bevel = obj.modifiers.new(name="Bevel", type='BEVEL')
bevel.width = 0.002
bevel.segments = 3
bevel.limit_method = 'ANGLE'
bevel.angle_limit = math.radians(30.0)
# Harden the normals so the bevel faces do not drag the flat faces
bevel.harden_normals = True
for poly in obj.data.polygons:
poly.use_smooth = TrueThe harden_normals option makes the normals of the large faces keep pointing straight out. Only the narrow bevel faces blend. This is the single most useful setting for removing the dark gradient that spreads across a flat panel next to a bevel.
Common Shading Artifacts and Their Causes
The table lists the problems you are most likely to meet on a prop, with the usual cause and fix.
| Symptom | Likely cause | Fix |
|---|---|---|
| Soft gradients across a flat panel | Smooth shading with normals averaged over a hard corner | Add a bevel, mark the corner sharp, or enable Harden Normals |
| Dark triangular patches on a flat face | An n-gon or a triangle fan that smooths unevenly | Re-cut the face into quads, or mark its boundary edges sharp |
| Pinched dark lines after a Boolean cut | Cut faces with long thin triangles | Clean the topology around the cut, then re-bevel |
| Some faces look black or inverted | Face normals point inward | Select all in Edit Mode and use **Mesh > Normals > Recalculate Outside** |
| Shading changes after scaling an object | Negative or non-uniform scale | Apply the scale with **Object > Apply > Scale** |
| Mirror seam visible down the middle | Normals not matching across the mirror plane | Turn on Clipping and Merge, then recalculate the normals |
Checking Normals
Turn on the normals overlay to see what Blender sees. In Edit Mode open the Overlays dropdown, scroll to Mesh Edit Mode, and enable Face Orientation in the main overlays list. Blue faces point outward and red faces point inward. A clean prop is all blue.
To see the normal directions, enable the Normals buttons in the Mesh Edit Mode overlays. Short lines show each face or corner normal. Look for lines that point the wrong way or lines that fan out across a flat face.
Applying Scale
Scale is a common hidden cause. If you scaled an object in Object Mode without applying it, the object carries a scale value other than 1. Modifiers such as Bevel then work in a distorted space. A bevel of 2 mm may look wider on one axis than another. Apply the scale before you finish the bevels.
import bpy
obj = bpy.context.active_object
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)Order of the Modifier Stack
Shading depends on the stack order. A reliable order for a hard-surface prop is:
- Mirror
- Boolean
- Bevel
- Weighted Normal (optional)
Bevel comes after Boolean so that it rounds the edges of the cut. Mirror comes first so that only the half you modelled is processed.
The Weighted Normal modifier is an optional last step. It sets each corner normal using the area of the faces around it, so large faces dominate. The effect is similar to Harden Normals but works on the whole mesh. Enable Keep Sharp on it so your marked edges stay crisp.
import bpy
obj = bpy.context.active_object
wn = obj.modifiers.new(name="Weighted Normal", type='WEIGHTED_NORMAL')
wn.keep_sharp = True
wn.weight = 50A Working Routine
Use this order each time you finish a shape.
- Apply the object scale.
- Recalculate normals outside and check Face Orientation.
- Apply Shade Smooth by angle at 30 degrees.
- Add the Bevel modifier with the same angle limit and Harden Normals on.
- Look at the object under a strong, moving light. Rotate a light or use a matcap that shows reflections, because a plain grey viewport hides most shading faults.
- Fix remaining patches by marking edges sharp or by cleaning the topology, which the next chapter covers.
Exercise
A flat side panel of your prop shows a soft dark gradient near a bevelled edge, even though Shade Smooth is on and the bevel angle limit is 30 degrees. Name two settings or operations that would remove the gradient without adding any geometry.
Show answer
Enable Harden Normals on the Bevel modifier so the large face keeps its outward normals, or add a Weighted Normal modifier with Keep Sharp enabled at the end of the stack. Marking the panel's boundary edges sharp would also work. Applying the object scale is worth checking too if the gradient is uneven.
Exercise
You mark an edge sharp, then run Shade Auto Smooth at 30 degrees in Blender 4.1 or later. The edge you marked is now smooth. Why did this happen, and how should you order the steps?
Show answer
The angle-based operation writes to the same sharp flags as Mark Sharp, so it overwrote your manual mark when the edge was below the angle. Run the angle-based pass first, then add the manual Mark Sharp edges afterwards.