Sub topic 12
Rendering a Preview and Exporting
This chapter finishes the prop. You will frame it with a camera, light it, render a preview image, and export a mesh that behaves the same way in another application. It assumes you can use Object Mode and the modifier stack. It also assumes the prop already has its modifiers (Mirror, Boolean, Bevel), its shading, and its materials and UVs from the earlier chapters. Python examples target Blender 4.x and use the bpy module in the Scripting workspace.
What this stage is for
A preview render and an export have different jobs.
- The preview render is a picture. It shows the silhouette, the edge highlights from your bevels, and the panel cuts. You use it to judge the prop and to show it to others.
- The export is data. It must carry the correct size, orientation, shading, materials and UVs, and it must contain only the geometry you intend to ship.
The two are linked. If the render shows an artifact, the exported mesh will carry it too. Render first, fix problems, then export.
Setting up a preview render
Choose a render engine
Blender has two main engines.
| Engine | Strength | When to use it for a preview |
|---|---|---|
| Eevee | Fast, real-time rasterizer | Quick turnarounds while you check bevels and shading |
| Cycles | Path tracer, physically based | Final stills with accurate reflections and shadows |
Hard-surface props depend on reflections, so Cycles often shows bevel highlights more faithfully. Eevee is usually good enough for checking progress. In Python, the Cycles identifier is 'CYCLES'. The Eevee identifier changed between versions ('BLENDER_EEVEE_NEXT' in 4.2 to 4.5, 'BLENDER_EEVEE' otherwise), so check the engine dropdown in your version before scripting it.
Camera and lighting
Use a moderate focal length, such as 50 mm to 85 mm. Wide lenses distort hard-surface shapes and make proportions look wrong. A three-quarter view, slightly above the prop and turned about 30 to 45 degrees, shows the front, side and top planes in one image.
For light, one large area light at about 45 degrees to the side of the camera gives soft gradients across bevels. A dim fill light or a plain world colour keeps the shadows from going fully black. Large light sources produce wide, soft highlights. Small, harsh ones make bevels look like thin white lines.
A scripted preview setup
The script below creates a camera aimed at an object, adds an area light, and renders a still. Save your .blend file first, because the output path is relative to it.
import bpy
scene = bpy.context.scene
target = bpy.context.active_object # the prop
# Camera that always points at the prop
cam_data = bpy.data.cameras.new("PreviewCam")
cam_data.lens = 60 # focal length in mm
cam = bpy.data.objects.new("PreviewCam", cam_data)
scene.collection.objects.link(cam)
cam.location = (0.8, -0.8, 0.5) # metres, because unit scale is 1.0
track = cam.constraints.new('TRACK_TO')
track.target = target
track.track_axis = 'TRACK_NEGATIVE_Z'
track.up_axis = 'UP_Y'
scene.camera = cam
# One large soft key light
light_data = bpy.data.lights.new("Key", type='AREA')
light_data.energy = 200
light_data.size = 1.0
key = bpy.data.objects.new("Key", light_data)
scene.collection.objects.link(key)
key.location = (1.0, -0.5, 1.2)
# Render settings
scene.render.engine = 'CYCLES'
scene.cycles.samples = 64
scene.cycles.use_denoising = True
scene.render.resolution_x = 1920
scene.render.resolution_y = 1080
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = 'PNG'
scene.render.filepath = "//preview.png"
bpy.ops.render.render(write_still=True)Because the Track To constraint is live, you can move the prop and the camera stays aimed at it. The // prefix means "next to the .blend file".
What to look for in the render
Read the image against your references, not just for looks.
- Bevel highlights. Every hard edge should catch a thin, even line of light. A missing line means that edge was not bevelled. An uneven line means the bevel width varies or the bevel angle limit skipped it.
- Shading artifacts. Dark smears or ripples across flat faces point back to normals and sharp edges.
- Boolean seams. Look for stray triangles or pinched geometry around cut openings.
- Proportions. A perspective render can reveal errors that orthographic views hide. Compare it with your reference images.
Preparing the model for export
An export captures what Blender would draw or evaluate, so prepare the scene before you run it. Work through this list.
- Scale and units. Display units (millimetres) do not change stored values. With a unit scale of 1.0, one Blender unit is one metre, and a 40 mm part is stored as 0.04. Exporters read the stored values, so the file is correct even though the UI shows millimetres.
- Apply object transforms. Press Ctrl+A in Object Mode and choose Scale (or All Transforms). An object with scale 2.0 and mesh data in the original size may import wrongly elsewhere. Negative scale values can flip normals.
- Modifiers. Decide whether the exporter applies them. glTF and FBX exporters can apply modifiers on export. This is convenient, but the modifier stack is evaluated as it stands, so check the Mirror, Boolean and Bevel results first.
- Cutters and helpers. Boolean cutter objects, reference images and empties should not be in the file. Select only the prop and export with a selection-only option.
- Origin. Put the object origin where the prop should rotate or sit, often at the base centre. Game engines and other tools use it as the pivot.
- Normals. Check that face orientation is blue everywhere in the Face Orientation overlay. Red faces face inward.
- Triangles. Most game engines triangulate on import. You can add a Triangulate modifier as the last modifier to control how quads are split, rather than leaving it to the importer. Keep it last, after Bevel.
- Materials and UVs. Every material slot should be assigned, and the UV map should exist on the final mesh. Materials built on the Principled BSDF node export best to glTF.
Choosing an export format
| Format | Good for | Notes |
|---|---|---|
| glTF / GLB | Web viewers, game engines, general exchange | Stores PBR materials, UVs, normals. GLB packs everything into one file. Uses Y-up by default. |
| FBX | Unity, Unreal, many DCC tools | Widely supported. Scale and axis settings need attention. |
| OBJ | Simple geometry exchange | No scene hierarchy or modern material model. |
| STL | 3D printing | Geometry only, no materials or UVs. The mesh must be watertight. |
If you have no other requirement, choose GLB. It carries the most information in the least fuss.
Axis conventions
Blender uses Z-up. glTF uses Y-up, and the Blender exporter converts for you when its Y-up option is on. FBX has forward and up axis settings. If the prop arrives lying on its side in another tool, an axis setting is the usual cause, not the mesh.
A scripted export
This script selects only the prop and writes a GLB and an FBX next to the .blend file.
import os
import bpy
prop = bpy.data.objects["Prop"] # change to your object's name
# Select only the prop
bpy.ops.object.select_all(action='DESELECT')
prop.select_set(True)
bpy.context.view_layer.objects.active = prop
export_dir = bpy.path.abspath("//exports")
os.makedirs(export_dir, exist_ok=True)
# glTF binary
bpy.ops.export_scene.gltf(
filepath=os.path.join(export_dir, "prop.glb"),
export_format='GLB',
use_selection=True,
export_apply=True, # apply modifiers on export
export_yup=True,
)
# FBX
bpy.ops.export_scene.fbx(
filepath=os.path.join(export_dir, "prop.fbx"),
use_selection=True,
use_mesh_modifiers=True,
apply_unit_scale=True,
axis_forward='-Z',
axis_up='Y',
add_leaf_bones=False,
)Both operators export only selected objects. The Boolean cutter is not selected, so it stays out of the files even though the Boolean modifier still reads it during evaluation.
Verifying the export
Do not trust an export until you have opened it somewhere else. The quickest check is in Blender itself.
- Save your work.
- Start a new scene with File > New > General, and delete the default cube.
- Import the file with File > Import.
- Check the dimensions in the N panel. They should match the real-world size you set in the units chapter.
- Check the shading. Flat panels should look flat, and bevels should still catch light.
- Check that materials are present and UVs are intact in the UV editor.
For a second opinion, open the GLB in a different viewer, such as a web-based glTF viewer. Differences between viewers often reveal missing normals or wrong material settings.
Common problems
- Prop is huge or tiny. A scale or unit setting is wrong. Check the unit scale and whether the exporter applied it.
- Prop is rotated 90 degrees. The axis settings do not match the target application.
- Shading is faceted or smeared. Custom normals may not have been exported. Enable normals in the exporter options, or export with sharp edges marked.
- Cut openings are missing. The Boolean cutter was hidden or deleted before export, or modifiers were not applied.
- Mirrored half missing. The Mirror modifier was not applied, or the exporter was set to ignore modifiers.
- Extra objects in the file. Selection-only was off.
Exercise
Your GLB imports into another tool at the right size but with the Boolean-cut window missing from the body. The window looks correct in Blender's viewport. Give two likely causes and one check for each.
Show answer
First, modifiers were not applied during export. Check that the glTF option to apply modifiers (export_apply in Python) is on, or apply the Boolean on a duplicate and export that. Second, the cutter was the only thing hiding the geometry from selection, or the Boolean's cutter object was excluded in a way that changes evaluation, such as being deleted. Check that the cutter still exists in the scene and is assigned in the Boolean modifier. Exporting only the body is fine, because the modifier reads the cutter during evaluation.
Exercise
The display unit is millimetres and the unit scale is 1.0. A bolt head is shown as 12 mm in the UI. What value is stored for its width, and what size should it have after importing the exported file?
Show answer
The stored value is 0.012 Blender units, because one unit is one metre. After import into a tool that uses metres, such as glTF viewers, it should be 0.012 m, which is 12 mm.