Sub topic 3
Controlling Shading with Sharp Edges and Smooth Shading
This chapter assumes you can switch between Object Mode and Edit Mode, select vertices, edges and faces, and that your prop already has its Mirror, Boolean and Bevel modifiers applied or visible in the stack.
Smooth shading and sharp edges
Smooth shading makes flat faces look curved by averaging the normals (the direction each face points) across shared vertices. Flat surfaces should stay flat, so you mark only the real hard edges as sharp.
Run this script in Edit Mode's parent Object Mode context to mark edges sharper than 30 degrees:
import math
import bpy
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.mesh.edges_select_sharp(sharpness=math.radians(30.0))
bpy.ops.mesh.mark_sharp()
bpy.ops.object.mode_set(mode='OBJECT')Reviewing topology and cleaning up
Topology is the layout of the edges and faces. Clean topology makes shading and later edits predictable.
- Remove loose vertices and doubled geometry with Mesh > Clean Up.
- Look for triangles and n-gons on curved areas and reroute edges where you can.
- Check that the Boolean results have no tiny sliver faces.
Checking proportions against the references
Turn on the front, side and top reference images, then compare each dimension of the prop with its measured value. Correct errors in Object Mode by scaling the whole object, or in Edit Mode by moving individual edges.
| View | Check | Typical error |
|---|---|---|
| Front | Width and height | Too wide at the base |
| Side | Depth and bevel radius | Lid too thick |
| Top | Panel position | Cut offset from centre |
Basic materials and UV unwrapping
A material gives the surface its colour and roughness. UV unwrapping flattens the surface so textures can be painted onto it.
import math
import bpy
obj = bpy.context.active_object
mat = bpy.data.materials.new(name="Painted Metal")
mat.use_nodes = True
obj.data.materials.append(mat)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.smart_project(angle_limit=math.radians(66.0))
bpy.ops.object.mode_set(mode='OBJECT')Rendering a preview and exporting
Render a preview with F12, then export the selected object as a GLB file:
import bpy
bpy.ops.object.select_all(action='DESELECT')
bpy.context.active_object.select_set(True)
bpy.ops.export_scene.gltf(
filepath="prop.glb",
export_format='GLB',
use_selection=True,
)Exercise
Exercise
A flat panel shows a dark streak across its centre after smooth shading. Which edge is the most likely cause, and how do you fix it?
Show answer
The edge where the panel meets a nearby Boolean cut is usually the cause. Mark that rim edge as sharp, or add a small bevel to it, then check the shading again.