Render a 3D Scene with a Coding Agent
Use a coding agent and Blender Python to render a 3D scene from a prompt.
Introduction
30 Second Summary
A scene in your imagination can feel clear long before you know how to create it on a screen. The hardest part is often getting from that idea to the first image.
In this project, you will use Blender with a coding agent to turn plain-English prompts into a rendered 3D scene. You will keep the Python scene script that creates each image.
What You'll Build
Your prompt becomes a PNG you can open to see the scene exactly as Blender rendered it.
By the end of this project, you'll have:
- A first PNG render that shows a simple object on a plain background.
- A before-and-after pair that makes your new background visible. It also shows the lighting changes from your follow-up prompts.
- A reusable Python scene script you can run without the agent. You can edit one number yourself. The next image changes in the way you predicted.
- Secret Mission: An optional challenge to push your skills further.
Are there any prerequisites?
You need a Mac with enough storage for the Blender download. You also need access to a coding agent that can run shell commands.
Before We Start
Your scene script needs a predictable home. Each rendered image needs to land beside it.
This step confirms that your Mac can reach the internet. You also prepare Terminal plus a coding agent to work inside one empty folder.
In this step, get ready to:
- Confirm the Mac prerequisites are ready.
- Create the empty blender-prompt-scene folder.
- Open the project folder in your coding agent.
Confirm Terminal and internet access
Your internet connection provides the Blender download in the next step. Terminal runs the rendering commands later in the project.
- Refresh this project page to confirm your internet connection.
- Press Cmd+Space to open the macOS search bar.
- Type Terminal into the search field.
- Press Return to open Terminal.
You will see a Terminal window with a command prompt. That prompt confirms your Mac is ready to run local commands.
Terminal Not Opening?
- Open Finder from the Dock.
- Open the Applications folder.
- Open the Utilities folder.
- Double-click Terminal.
If Terminal still does not open, help me troubleshoot Terminal on macOS.
Create the project folder
One dedicated folder keeps the agent focused on this project. It also keeps the future Python script beside every PNG render it produces.
- Click an empty area of your Desktop to make Finder active.
- Click File in the menu bar.
- Click New Folder.
- Type blender-prompt-scene as the folder name.
- Press Return to save the name.
- Double-click the blender-prompt-scene folder to inspect it.
Good work. Finder now shows an empty blender-prompt-scene folder ready for your project artifacts.
Why Start With an Empty Folder?
An empty folder gives the coding agent a clear workspace boundary. The scene script lands here.
Each rendered PNG will sit beside that script. This makes every prompt-driven change easy to compare.
Open the folder in your coding agent
A coding agent needs access to the correct local folder before it can create files. Use an agent that can work with local folders plus shell commands.
- Press Cmd+Space to open the macOS search bar.
- Type your coding agent's app name into the search field.
- Press Return to open the agent.
- Choose the control on the agent's start screen or top menu for opening a local folder.
- Select Desktop in the folder picker.
- Select the blender-prompt-scene folder.
- Confirm the folder selection.
- Approve access to blender-prompt-scene if macOS requests permission.
Before you inspect the workspace, what should its file panel contain for a brand-new project?
- Check the coding agent's file panel for the open folder.
You will see blender-prompt-scene as the open folder. Its file panel will be empty.
Folder Not Open in the Agent?
- Check that the workspace name is blender-prompt-scene.
- Reopen blender-prompt-scene if the file panel shows files from another project.
- Grant folder access in the macOS permission prompt if the agent cannot display the folder.
If the folder still does not appear, help me open a local folder in my coding agent.
Your empty project workspace is ready. Next up, you will install Blender so the coding agent has a 3D renderer to control.
Install and Open Blender
A coding agent can only drive Blender when the application is installed where the agent expects to find it. A missing application path stops every later render before the scene script can run.
This step places Blender at /Applications/Blender.app. You will open it once to clear macOS's first-launch checks.
In this step, get ready to:
- Install Blender in /Applications/Blender.app.
- Open Blender once to approve its first launch.
- Launch Blender from Terminal using its executable path.
Download and install Blender
The official Blender website provides the macOS installer. Putting the application in your Mac's Applications folder creates the path your coding agent uses later.
The download can take a while because Blender is a large desktop application. A moving browser progress indicator means the download is still working.
- Visit the official Blender website in your browser.
- Use the website's download area to download the macOS installer recommended for your Mac.
- Wait for the download to finish.
- In Finder, select Downloads in the sidebar.
- Double-click the downloaded Blender installer.
- Drag Blender into the Applications folder shown in the installer window.
- In the Finder sidebar, select Applications.
- Confirm that Blender appears in Applications.
You should see Blender in Applications. This confirms the application is installed at /Applications/Blender.app.
Blender missing from Applications?
- Confirm that the browser finished downloading the installer.
- Reopen the downloaded installer from Downloads.
- Drag Blender into the Applications folder again.
Ask for help if the installer still does not place Blender in Applications: help me install Blender in the macOS Applications folder
Open Blender for the first time
macOS checks downloaded applications during their first launch. Opening Blender yourself lets you approve that launch before your coding agent calls the executable.
- In Finder, double-click Blender inside Applications.
- Approve the macOS confirmation if it appears.
- Complete any first-run setup panel using its default choices.
- Click outside the welcome panel to reveal the 3D viewport.
You should see the default startup scene with a cube in the center. A camera plus a light should sit around it.
That first launch is the fiddly part done. macOS now allows Blender to run from its installed location.
Blender does not reach the startup scene?
- Return to the Applications folder in Finder.
- Open Blender directly from that folder again.
- Follow any macOS confirmation that appears.
Ask for help if Blender closes before showing the scene: help me troubleshoot Blender's first launch on macOS
Launch Blender from Terminal
Your coding agent uses Blender's executable directly. Testing the same path now proves the application is ready for command-line rendering.
- In the macOS menu bar, open the Blender menu.
- Select Quit Blender.
- Press Cmd+Space to open Spotlight.
- Type Terminal into Spotlight.
- Press Enter to open Terminal.
Before you run this, predict whether Terminal opens the same startup scene.
- Launch Blender from Terminal by running this command:
/Applications/Blender.app/Contents/MacOS/Blender
What does this command do?
The path calls Blender's executable directly from Terminal. Your coding agent can use the same executable to render scenes without relying on Finder.
You should see a new Blender window with the startup scene. This proves the executable path is ready for command-line rendering.
- Return to Terminal after the Blender window opens.
- Press Ctrl+C to stop the command.
You should see the Terminal prompt return. Blender has now passed both its first-launch check and its command-line launch check.
Blender does not open from Terminal?
- Confirm that Blender still appears in the Applications folder.
- Check that the application is installed at /Applications/Blender.app.
- Copy the command again without changing its capitalization.
Ask for help if the executable path still fails: help me troubleshoot the Blender executable path
You have cleared the main setup hurdle. Next, your coding agent uses this Blender installation to create a scene script and render your first PNG.
Generate Your First Scene
Blender is installed and ready to render. Your empty project folder still needs a scene recipe before it can produce an image.
A coding agent can turn a plain-English scene description into a Python script. Blender can run that script headlessly, which means it renders without opening the full interface.
In this step, get ready to:
- Describe a simple scene to your coding agent.
- Generate scene.py through Blender's Python API.
- Render the scene as render-01.png.
Prompt your coding agent
A precise prompt stops the agent from guessing how Blender is installed. It also gives you predictable artifact names.
- Paste the following request into the coding agent chat from earlier:
Use Blender at /Applications/Blender.app/Contents/MacOS/Blender and its Python API to create a simple scene in this folder. Generate scene.py. The scene must contain one simple object on a plain background. Add a positioned camera. Add a light that makes the object visible. Configure the output as a PNG named render-01.png in this folder. Run Blender headlessly with scene.py to produce render-01.png. Keep the script and image in the project folder. When finished, tell me which files you created and whether the render completed successfully.
What does this prompt ask for?
- The exact Blender executable path prevents the agent from guessing where the application is installed.
- The scene.py filename gives you a reusable recipe for the scene.
- The render-01.png filename creates a fixed visual checkpoint.
- The scene requirements make the first result easy to judge.
Your coding agent may pause before it writes files or launches Blender. That pause gives you a chance to review the requested action.
The first render can take a little while on a CPU. A quiet terminal during rendering does not mean the process has stalled.
- Submit the prompt to your coding agent.
- Approve each file or Blender request that matches the prompt.
When the run completes, your agent should report that it created scene.py and rendered render-01.png successfully.
Render did not finish?
- Tell the agent to use /Applications/Blender.app/Contents/MacOS/Blender if it cannot locate Blender.
- Ask the agent to confirm its current folder is blender-prompt-scene if no files appear.
- Ask the agent to inspect its run output if the rendering process stops.
help me diagnose why my coding agent did not create the Blender render files.
Confirm both artifacts
The Python file is your reusable scene recipe. The PNG is visual proof that Blender executed it.
- Return to the coding agent's file list for blender-prompt-scene.
- Confirm scene.py appears in the file list.
- Confirm render-01.png appears beside it.
You now have a working scene pipeline. Your prompt became a reusable script plus a rendered image.
Open your first render
The image provides the clearest test of the agent's work. It shows whether the camera captured the scene successfully.
Before you open it, which parts of your prompt do you expect to recognize in the image?
- Open render-01.png from the coding agent's file list.
You should see a simple object against a plain background. The camera should frame the object clearly because the scene includes a light.
Is the render black or empty?
- Remind the agent that the scene must include a positioned camera.
- Remind the agent that the light must make the object visible.
- Ask the agent to rerun the same scene.py file after fixing the scene.
help me fix a Blender render that looks black or empty.
Your first scene is rendered and saved beside the script that created it. Next up, you will connect the camera and light lines in scene.py to what you see in the image.
Inspect the Camera and Light
That first PNG is a solid milestone. Blender has run the scene written by your coding agent.
Inside scene.py, the camera choices shape the viewpoint. The light choices determine the illumination.
This step connects those choices to render-01.png. You will be able to point to the relevant lines in the script.
In this step, get ready to:
- Inspect scene.py without changing the generated code.
- Identify the lines that create or position the camera.
- Identify the lines that create or position the light.
Map the generated script
Blender's Python API records scene decisions as editable instructions. A section map helps you understand the agent's work without altering it.
- Select scene.py from the project file list in the coding agent.
- Tell the coding agent to inspect the script without changing the file.
- Ask the coding agent to map the sections responsible for the scene object setup.
- Ask the coding agent to map the camera setup.
- Ask the coding agent to map the light setup.
- Ask the coding agent to map the render output setup.
You should see a map that clearly separates the camera setup from the light setup. The response should also point you toward the relevant parts of scene.py.
Why Inspect Generated Code?
The render shows the result. The script preserves the decisions that produced it.
Reading those decisions gives you a reusable scene instead of a one-time image. You can target later changes with more precise prompts.
Trace the camera viewpoint
The camera defines the virtual viewpoint of a 3D render. Its placement controls the angle from which you see the object.
- Use the section map to locate the camera setup in scene.py.
- Ask the coding agent to point to the exact line that creates the camera object.
- Ask the coding agent to point to the exact line or lines that place the camera.
- Select render-01.png from the project file list.
- Compare the visible angle with the agent's explanation of the camera placement.
You should be able to connect the camera placement in scene.py to the angle shown in render-01.png.
Creation Versus Placement
The creation line adds a camera object to the scene. The placement lines decide where that camera observes the scene from.
That placement becomes the viewer's position in the final image. Moving it changes what fits inside the frame.
Trace the light source
A light makes the surfaces in a 3D scene visible. Its placement influences which areas look bright or shadowed.
- Switch back to scene.py in the coding agent.
- Use the section map to locate the light setup.
- Ask the coding agent to point to the exact line that creates the light object.
- Ask the coding agent to point to the exact line or lines that place the light.
- Return to render-01.png.
- Compare the lit surfaces with the agent's explanation of the light placement.
You should be able to connect the light placement in scene.py to the illuminated surfaces in render-01.png.
What Does the Light Control?
The light determines how the scene's surfaces receive illumination. Its position changes the direction from which that illumination reaches the object.
This is why camera placement and light placement produce different visual effects. One controls where you look from. The other controls how the subject is lit.
Before the final check, do you expect the creation line or the placement lines to explain the visible angle? Hold that prediction in mind.
- Explain to the coding agent which existing camera lines control the viewpoint.
- Explain to the coding agent which existing light lines control the illumination.
- Ask the coding agent to check your explanation against scene.py without changing the file.
The camera references should map to the rendered viewpoint. The light references should map to the illumination.
That is a real step forward. You can now connect two parts of an agent-generated script to visible choices in the render.
You can now read the scene's viewpoint and illumination choices. Next, you will use that understanding to improve the background. You will also ask for better lighting.
Improve the Scene Lighting
Your first Blender render proved that scene.py can turn a scripted scene into an image. You also know which parts of the script control the camera and light.
The plain background and basic lighting make that first image a useful baseline. In this step, your coding agent improves those visual choices while preserving the original render.
In this step, get ready to:
- Request a visible background plus improved lighting from the coding agent.
- Create a second PNG render named render-02.png.
- Compare the background and lighting in both renders.
Ask the agent to enhance the scene
A visual prompt should name the desired scene changes. It should also protect render-01.png from being overwritten.
The coding agent may ask for permission to edit the script or run Blender. Those confirmations keep each local action under your control.
- Switch back to the coding agent with blender-prompt-scene open.
- Ask the agent to update and render the scene by sending this prompt:
Update the existing scene.py in this folder.
Preserve the existing scene object.
Add a visible background.
Improve the lighting so the object is clearly illuminated.
You may refine the camera angle if it improves the composition.
You may refine the object materials if it improves the presentation.
Keep render-01.png unchanged.
Set the PNG output to render-02.png.
Save render-02.png in the current blender-prompt-scene folder.
Run scene.py headlessly using Blender installed at /Applications/Blender.app/Contents/MacOS/Blender.
After the render finishes, confirm that render-01.png and render-02.png both exist.
Summarize the changes made to the background, lighting, camera, and materials.
What does this prompt control?
- The instruction to preserve render-01.png keeps your original image available as a baseline.
- The distinct render-02.png filename gives the enhanced scene its own output.
- The updated scene.py remains the reusable source for the enhanced scene.
- The full Blender path prevents the agent from guessing where the application is installed.
- Approve the change to scene.py if an edit permission request appears.
- Approve the command using /Applications/Blender.app/Contents/MacOS/Blender if a run permission request appears.
- Wait for the agent to report that the render has completed.
- Check the coding agent's file list for the updated artifacts.
You should still see render-01.png in the file list. Your original baseline remains intact.
You should see a modified scene.py. A new render-02.png should sit beside it.
That is the hard part done: the enhanced render exists without replacing your baseline.
Missing the second render?
- Check that the updated script names render-02.png as its output.
- Ask the agent to inspect the Blender run output for the point where rendering stopped.
- Ask the agent to correct scene.py before rerunning the render.
help me find why render-02.png was not created.
Compare the two renders
The two filenames create a controlled before-and-after comparison. Visual differences reveal exactly how the new prompt affected the scene.
Before you compare the images, pause on this question: which part of the frame do you expect the lighting prompt to change most.
- Select render-01.png in the coding agent's file list to preview the original image.
- Inspect the original background.
- Inspect how clearly the light defines the object.
- Select render-02.png to preview the enhanced image.
- Compare its background with the first render.
- Compare its illuminated areas with the first render.
- Compare its shadow edges with the first render.
- Check for any camera or material refinement that you requested.
You should see a visible background in render-02.png. The lighting should define the object's form more clearly.
Any requested camera or material refinement should also be visible. The original render-01.png gives you direct evidence of each change.
Is the second render still too dark?
- Ask the agent to check whether the light reaches the object's visible side.
- Ask the agent to adjust the lighting before producing a fresh render-02.png.
- Confirm that the rerender still preserves render-01.png.
help me improve a Blender render that still looks too dark.
Your updated script now has two renders that expose the effect of a targeted prompt. Next, you take direct control by changing one value in scene.py before rerunning Blender yourself.
Edit and Render the Script Yourself
Your enhanced second render shows that the coding agent can reshape the scene. This final step puts you in control of the script.
Reusable automation depends on being able to change a value without another prompt. You will update scene.py yourself.
Then you will run Blender from Terminal to create a third PNG. The visible result proves that you can keep using the script independently.
In this step, get ready to:
- Point scene.py at a new output file.
- Change the camera height yourself.
- Render from Terminal to verify the predicted visual shift.
Preserve your earlier renders
Each render path protects an earlier experiment from being overwritten. Pointing the script at render-03.png keeps both comparison images intact.
- Select scene.py from the coding agent's file list.
- Replace the output filename render-02.png with render-03.png.
- Save scene.py.
You'll see render-03.png on the output line where render-02.png appeared before. Your second image is now protected from the next render.
Make one manual change
A single numeric change creates a controlled experiment. Changing only the camera height makes the visual result easy to connect to your edit.
- Return to the camera-location line you identified earlier in scene.py.
- Increase the number that controls the camera height by 1.0.
- Save scene.py.
You'll see one changed camera number in the saved script. Everything else in the scene remains available for a direct comparison.
Render from Terminal
Headless rendering runs Blender without opening its graphical window. The Python script still builds the scene before saving the finished image.
- Switch to Terminal on your Mac.
- Return to the existing blender-prompt-scene folder that contains scene.py.
A detailed scene can leave Terminal quiet for a few minutes while Blender renders. Let the process continue until the prompt returns.
Before you run this, picture how the higher camera position should change the framing.
- Render your edited scene manually by running this command:
/Applications/Blender.app/Contents/MacOS/Blender --background --python scene.py
What does this command do?
- The path at the beginning launches the Blender executable inside /Applications/Blender.app.
- The --background option runs Blender without opening its interface.
- The --python option tells Blender to execute scene.py.
- The script saves the completed render as render-03.png.
When Terminal's prompt returns, rendering has finished. You'll find render-03.png beside your first two images.
- Open render-03.png from the coding agent's file list.
- Open render-02.png for comparison.
- Arrange the two images side by side.
You'll see the camera viewpoint or subject framing shift in the direction you predicted. The background and improved lighting remain in place.
That's the ownership moment: your manual edit produced a new render without another agent prompt. You can now adjust the script whenever the scene needs to change.
Render missing or unchanged?
- Confirm Terminal is using the blender-prompt-scene folder that contains scene.py.
- Confirm the saved output filename in scene.py is render-03.png.
- Increase the camera-height number by a larger amount if the visual shift is too subtle.
- Rerun the render command after saving the correction.
Help me diagnose why my Blender script did not create a visibly different third render.
Secret mission
Prove Your Render Is Reproducible
Prove that your latest scene can be rebuilt from `scene.py` alone. Audit the script. Rerun Blender headlessly to confirm that your manual change survives regeneration.
Clean Up Your Resources
Your local Blender files add no ongoing project costs. Choose whether to keep the artifacts, pause your work, or delete the folder.
Resources you used:
- The blender-prompt-scene local folder. It contains scene.py, render-01.png, render-02.png, and render-03.png.
Keep everything running
No action needed. Choose this option if you want to rerun or edit the scene again.
- Keep scene.py, render-01.png, render-02.png, and render-03.png together inside blender-prompt-scene.
- Move any unwanted .blend working files from blender-prompt-scene to your Mac's trash.
- Move any unwanted temporary render output to your Mac's trash.
- Commit the blender-prompt-scene folder if you already use version control.
Pause - I'll come back to this later
The headless render exits after it writes render-03.png, so there is no render process to stop. Your files stay available while the apps are closed.
- Close your coding agent.
- Close Blender if it is still open.
- Leave blender-prompt-scene in its current location.
- Return to blender-prompt-scene through your coding agent when you are ready to continue.
Delete - I don't want to use this again
Deleting the folder permanently removes scene.py plus all three PNG renders. The Blender app stays installed for future projects.
- Use Finder search to locate blender-prompt-scene.
- Move blender-prompt-scene to your Mac's trash.
- Empty your Mac's trash.
- Confirm Finder no longer shows blender-prompt-scene in its original location.
Nice Work!
Nice Work!
Brilliant work! Your editable 3D scene now produces three renders in Blender. The final image reflects a change you made yourself.
You've learned how to:
- Guide a coding agent to write a reusable Python script for scene automation. Open render-01.png as visible proof that the script works.
- Refine the scene's background. Improve its lighting. Compare render-01.png with render-02.png to see the visual difference.
- Read scene.py to locate the camera controls. Find the material values that shape the render. Rerun the script from Terminal to produce render-03.png without the coding agent.
- Secret Mission: Take on the optional challenge to push your Blender automation skills further.
Ready to quiz yourself?