Last active
February 9, 2021 22:04
-
-
Save tasinttttttt/930065f015bdf511ef08da68aec46a74 to your computer and use it in GitHub Desktop.
blender render in splitted image for images that dont fit in ram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import os | |
# Usage: | |
# blender -b FILE.blend -P blender_render_split_image.py | |
# Backup from | |
# https://stackoverflow.com/a/38223109 | |
cut_into = 10 | |
output_folder = '//renders' | |
rndr = bpy.context.scene.render | |
rndr.use_border = True | |
rndr.use_crop_to_border = False | |
for row in range(cut_into): | |
for col in range(cut_into): | |
filename = "chunk_{}_{}".format(row + 1, col + 1) | |
rndr.filepath = os.path.join(output_folder, filename) | |
rndr.border_min_x = (1 / cut_into) * row | |
rndr.border_max_x = (1 / cut_into) * (row + 1) | |
rndr.border_min_y = (1 / cut_into) * col | |
rndr.border_max_y = (1 / cut_into) * (col + 1) | |
bpy.ops.render.render(write_still=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment