Drop in any STL, get a finished product photograph.
One Blender script that imports a mesh, scales it, rests it on paper, lights it like a studio shoot and frames it — no scene setup, no tweaking. Default settings reproduce the same look every time, whatever the model's original size or units.
DIN‑5 connector · Stargate ring · Stanford bunny · Duke Nukem — 1000 px previews. The two figures are shot at --el 34 so the pose reads instead of being flattened from above.
./render.sh --stl part.stlpart-render.png 2400 × 2400
part-render.jpg same frame, quality 95
Sample input and output live in examples/ — the 13 × 14 mm DIN‑5 socket
above, rendered at 2400 px.
./render.sh --stl part.stl --rot 90 0 0 # lay it on its side
./render.sh --stl part.stl --color "#1E4D4B" --paper "#C9BFA8"
./render.sh --stl part.stl --fill 0.72 --res 3200 --samples 512| flag | default | |
|---|---|---|
--stl |
required | input model |
--rot RX RY RZ |
0 0 -10 |
rotation in degrees, before framing |
--color |
#731811 |
body colour |
--paper |
#A8A196 |
paper / backdrop colour |
--out |
<stl>-render.png |
output path |
--fill |
0.60 |
subject size as a fraction of the frame |
--az --el |
240 63 |
camera azimuth / elevation |
--lens |
200 |
focal length, mm |
--res --samples |
2400 360 |
square size, Cycles samples |
--exposure |
-6.1 |
film exposure |
--no-post --no-jpg |
off | skip grading / skip the JPEG |
- Imports & cleans — welds duplicate vertices, drops strays, unifies normals.
- Normalises — rotates, centres, rests on the paper (
min z = 0), scales the largest dimension to 14 mm. The light rig is identical for every model, at any unit or size. - Softens — 0.035 mm angle-limited bevel plus smooth-by-angle, so print tessellation reads as a moulded surface rather than a mesh.
- Frames itself — projects every vertex onto the camera axes and solves the distance
so the silhouette fills
--fill, centred to within a percent. - Lights it — a large warm key, cool fill, narrow rim, over a procedural paper sweep with fibre bump and a gentle undulation.
- Finishes — denoised 16-bit render, then highlight-safe exposure, gentle contrast, vignette, fine grain and unsharp mask, written as PNG + JPEG.
Every STL found in one machine's ~/Documents and ~/Downloads: 96 → 500 118 triangles,
0.01 → 25 MB, binary and ASCII — 19 rendered, 2 rejected as corrupt, 36 seconds for the
whole batch at preview quality. (contact sheet)
- Corrupt files fail loudly. NaN or empty geometry exits with a clear message and a non-zero status instead of writing a broken image.
- Orientation is the one manual knob. If a model arrives lying down,
--rot 90 0 0(or-90, or a Z twist) is usually the only adjustment it needs. - Camera angle is the second knob. The 63° default looks into open parts (a socket, a
cup); standing figures read better lower,
--el 34; flat or sheet-like parts want face-on,--el 85.
Blender 4.1+ (developed on 5.2). Uses Cycles with Metal on macOS and falls back to CPU.
BLENDER=/path/to/blender overrides the wrapper's default location.
