- Mar 2, 2020
- 47
- 80
I was looking into how to automate Rendering Blender Files using the CLI, and I came across this
What I'd like to do is create a Location in Google Drive, Dropbox, or OneDrive, where User A can upload .blend files. (Input Folder)
The uploaded files would sync to User B's Computer then get detected by TheFolderSpy. (A Folder Monitoring Program)
TheFolderSpy would then execute a batch script which would pass the .blend file and Rendering parameters to the Blender CLI.
When the render is finished, the output files would be placed in a second Folder. (Output Folder)
The Output Folder would upload the files to the cloud, where User A could access them.
Here is the Render.bat code posted on reddit
Here is (I assume) the params.py code from the same post:
If someone could confirm what the above code does, I'd appreciate it. And I would appreciate it even more if you could explain what each line does.
You must be registered to see the links
.What I'd like to do is create a Location in Google Drive, Dropbox, or OneDrive, where User A can upload .blend files. (Input Folder)
The uploaded files would sync to User B's Computer then get detected by TheFolderSpy. (A Folder Monitoring Program)
TheFolderSpy would then execute a batch script which would pass the .blend file and Rendering parameters to the Blender CLI.
When the render is finished, the output files would be placed in a second Folder. (Output Folder)
The Output Folder would upload the files to the cloud, where User A could access them.
Here is the Render.bat code posted on reddit
Code:
TIMEOUT /T 10 /NOBREAK
d:
cd \data\blender\incoming\
if exist "render.tmp" (
echo Instance Protection.
exit /b 1
)
echo "instance protection">>render.tmp
"C:\Program Files\Blender Foundation\Blender\blender.exe" -b "%1" -P params.py -E CYCLES -o "D:\Data\Blender\Renders\%date:~10,4%.%date:~4,2%.%date:~7,2%.%time::=.%." -F PNG -f 0
del render.tmp
pause
Code:
import bpy
bpy.context.user_preferences.system.compute_device_type = 'CUDA'
bpy.context.scene.cycles.device = 'GPU'
bpy.context.scene.cycles.use_square_samples = 0
bpy.context.scene.cycles.samples = 500
bpy.context.scene.render.tile_x = 250
bpy.context.scene.render.tile_y = 250
bpy.context.scene.render.resolution_percentage = 100