How to specify in command line list of tiles or part of the screen to be rendered?

Hello everyone!

I am still new in Cycles development and want to figure out one thing:

  • if I do not want to render all screen, but just a small part of it - how to specify it?

As I understand Cycles split the screen into tiles and render it separately - so if I specify some list of tiles - I will be able to render some specific part of the screen.
But in cycles binary command line I see params to specify tile width/height, samples count, but not tiles list to be rendered.

Could you please help me to figure out how to make rendering just some specific part of the screen?

Based on the answer here the following script can be used to specify a region of the image to render (called “border render” in Blender):

# border_render.py
# $ blender -b <file.blend> -P border_render.py -- <minx> <maxx> <miny> <maxy>
import bpy
import sys
argv = sys.argv
argv = argv[argv.index("--") + 1:]

scn = bpy.context.scene

# setup the render border
scn.render.use_border = True
scn.render.border_min_x = float(argv[0])
scn.render.border_max_x = float(argv[1])
scn.render.border_min_y = float(argv[2])
scn.render.border_max_y = float(argv[3])

# render a still frame
scn.render.filepath = '//out.png'
bpy.ops.render.render(write_still=True)

For example, call it with

blender -b file.blend -P border_render.py -- 0.1 0.8 0.1 0.3

Here, the min max values are all in range [0,1] and specify the area of the image to render. Note that Y=0 is the bottom of the image.

This will still output an image in the full resolution, it does not crop to the region specified.

1 Like

Thanks, Paul…
I will try.
But maybe it’s possible to make rendering without Blender but via Cycles renderer only? :slight_smile:

Ah, you’re working directly with the Cycles code. Then I think you should be able to set the same values on Cycles’ Camera class, instance variable border (but that’s from looking at the source just now, haven’t tried it).

In ideal case, I want not to change code of Cycles renderer, but just to use power of existing command line binary without launching Blender :slight_smile:

But seems that here is really code should be improved to be ready to work with specific tiles or screen part…

It will be much harder to improve C++ code than to improve Python scripts. But ok… let’s try :slight_smile:
(but I still hope that there exists easier way :slight_smile: )