Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

July 08, 2011

Tile Renderer (Make Big Renders)

This post was written quite some time before I completed a decent version of the tile renderer. Monster Tile Renderer - for more information, or search this blog or checkout the github page
import bpy
# tile rendering 0.1
# Dealga McArdle (zeffii) 2011-July 8.

# fill in how many tiles you want, must be non zero.
n = 2 # n tiles wide (x)
m = 2 # m tiles high (y)
percentage_of_current = 300
total_tiles = n*m
location = "/home/zeffii/"
filename = "MyRender"
filetype = "png"


name_list = []
for j in range(m):
    for i in range(n):
        name_list.append(str(i+1)+"_"+str(j+1))

border_list = []
wslice = 1/n
hslice = 1/m

# use border and crop
bpy.context.scene.render.use_border = True
bpy.context.scene.render.use_crop_to_border = True

# set resolution percentage
bpy.context.scene.render.resolution_percentage = percentage_of_current

for cell in name_list:
    wdiv, hdiv = cell.split("_")
    bmin_x = float((int(wdiv)-1)*wslice)
    bmax_x = float(int(wdiv)*wslice)
    bmin_y = 1.0 - (float(int(hdiv)*hslice))
    bmax_y = 1.0 - (float((int(hdiv)-1)*hslice))
        
    str_borders = ("bmin_x="+str(bmin_x),
                   "bmax_x="+str(bmax_x),
                   "bmin_y="+str(bmin_y),
                   "bmax_y="+str(bmax_y))
                   
    border_list.append((cell,str_borders))

    # set border for this tile
    bpy.context.scene.render.border_min_x = bmin_x
    bpy.context.scene.render.border_max_x = bmax_x
    bpy.context.scene.render.border_min_y = bmin_y
    bpy.context.scene.render.border_max_y = bmax_y 
    
    bpy.ops.render.render()
    RR = "Render Result"
    bpy.data.images[RR].save_render(location+filename+"_"+cell+"."+filetype)
    print("rendered", cell)