Blender Isometric Car Renderer
This script automates the process of rendering an isometric car model in Blender from multiple angles and compiles the resulting images into a spritesheet. The script ensures correct lighting, camera positioning, rendering settings, and image processing using Blender’s Python API and Pillow for image manipulation.
Camera and Light Setup
- Ensures an orthographic camera is present; otherwise, creates one.
- Configures an isometric perspective with predefined angles.
- Adds a
SUNlight source named"Iso_Light"if not found. - Positions the light to create soft shadows.
Car Model Setup
- Searches for an object named
"car-model". - Moves the camera to a fixed isometric position.
- Ensures all constraints on the car are muted for rotation control.
Rendering Settings
- Output format: PNG (with transparency).
- Image resolution:
80x80pixels per sprite. - Anti-aliasing: Disabled for sharp pixel rendering.
- Frame count:
60(adjustable for smoother rotation). - Rendering engine: Eevee (optimized for speed).
Rendering Process
- Loops through 60 angles, rotating the car around its Z-axis.
- Clears animation data and applies new rotation values.
- Renders each frame and saves it as a PNG file.
Spritesheet Generation
- Uses the Pillow library to combine all rendered images.
- Arranges images in one row, each offset horizontally.
- Saves the final spritesheet as
"spritesheet.png"in the output folder.
Output Directory
- The script automatically creates a
//spritesfolder inside the Blender project directory. - Individual frames are saved as
car_00.png,car_01.png, …car_59.png. - The final spritesheet is named
"spritesheet.png".
Example Usage
Running the Script in Blender
- Open Blender.
- Switch to the Scripting tab.
- Create a new script, paste the code, and run it.
Customization Options
| Parameter | Description | Default Value |
|---|---|---|
angles | Number of rotation frames | 60 |
image_size | Resolution of each sprite | (80, 80) |
camera.data.ortho_scale | Camera zoom level | 6 |
light.data.energy | Light intensity | 5 |
output_folder | Save location for images | "//sprites" |