AFAIK, there is no option to set tile sizes directly from the command line.
However, you could use the python api to do this, and execute a python script in blender from the command line. (see this question)
To set tile sizes from python, you can use
bpy.context.scene.render.tile_x
and bpy.context.scene.render.tile_y
.
Tile order can be set with bpy.data.scenes["Scene"].cycles.tile_order
.
This can be set to 'CENTER', 'RIGHT_TO_LEFT', 'LEFT_TO_RIGHT', 'TOP_TO_BOTTOM',
or 'BOTTOM_TO_TOP'
An example script to set the tile size to 32x32 and set the order to Right to Left
:
import bpy
for scene in bpy.data.scenes:
scene.render.tile_x = 32
scene.render.tile_y = 32
scene.cycles.tile_order = 'RIGHT_TO_LEFT'
Note that it loops through each scene to set these properties globally. (see this)
You can run this from the command line with
blender --background /path/to/my.blend --python /path/to/script.py --render-anim
# or the short version:
blender -b /path/to/my.blend -P /path/to/script.py -a
Borders:
AFAIK, it's not possible to tell blender to only render n amount of tiles, when n is less than the total tiles needed to render the complete image.
(blender does print a new line to stdout for every tile that is rendered, so you might be able to make some hack to stop blender once n tiles have been rendered, but I don't know if you could save output.)
Because of this, you might be better off using the Render Border; this will allow you to exactly define what section of the image to render.
You could then call blender to render repeatedly, using a script to pass different render border dimensions to do your own "tile render".
You can enable border with bpy.data.scenes["Scene"].render.use_border = True
The border region is defined by four values between 0
and 1
corresponding to the locations of the four sides of the render border relative to the camera where 0
is the left or bottom edge of the camera, and 1
is the right or top edge.
You can set the min and max xy values for the camera border with
bpy.data.scenes["Scene"].render.border_max_x
bpy.data.scenes["Scene"].render.border_min_x
bpy.data.scenes["Scene"].render.border_max_y
bpy.data.scenes["Scene"].render.border_min_y
You may also want to enable Crop to border with bpy.data.scenes["Scene"].render.use_crop_to_border = True
So to render half of the image vertically, you could run this:
import bpy
for scene in bpy.data.scenes:
scene.render.use_border = True
scene.render.use_crop_to_border = True
#this sets the render border to the left half of the camera.
#to render the right half, set max_x to 1 and min_x to .5
scene.render.border_max_x = .5
scene.render.border_min_x = 0
scene.render.border_min_y = 0
scene.render.border_max_y = 1
scene.render.tile_x = 32
scene.render.tile_y = 32
#then render:
bpy.ops.render.render()
Note that to set the viewport border you must use this instead, but you most likely are interested in camera border as viewport border is only relevant for using the realtime rendering feature. (see this post for more info)
Seeds:
This does not answer your question about tiles, but as you mentioned you want to do this for rendering on multiple machines, I thought I would mention this.
You could also combine different Cycles renders by using the Seed value. (See this post for more info)
This also is a good way to remove fireflies.