3
$\begingroup$

I'd like to be able to define a Render Region and recall it, if possible. Is there a way to do this? As it is now, a drawn Render Region is only temporary, and only one can be drawn at a time.

You can see the drawn render region below, and as I work on the project, I render the animated faders again and again. I'd love it if I could get the render region consistent from time to time instead of having to redraw it.

enter image description here

$\endgroup$
7
  • $\begingroup$ Hello :). As an alternative - You could duplicate your camera, lower the sensor size and use lens Shift to move the view. $\endgroup$ Mar 16 at 19:57
  • 1
    $\begingroup$ I've seen this post, and while it's somewhat helpful, it's not quite what I'm looking for. I suppose what I'm looking for isn't possible, but the idea is to be able to save a render border as an object that can be named and recalled as necessary. I've got a bunch of animated objects in my project I need to export separately. I would like to assign render regions to each of the exported elements, so I end up with consistent output through my many revisions. As it is, the render border is something that's drawn and deleted - it's just such a temporary entity! $\endgroup$ Mar 16 at 20:49
  • 2
    $\begingroup$ Hello again :). One another solution comes to mind - you could create your own render border using a plane with a "window" cutout and a holdout shader. The plane will render as a transparent area - which takes no time to render with adaptive sampling on. $\endgroup$ Mar 16 at 23:02
  • 1
    $\begingroup$ That's a great idea, too! Will try it out! $\endgroup$ Mar 17 at 10:51
  • 1
    $\begingroup$ That is definitely the best solution so far - works perfectly. Thanks!! $\endgroup$ Mar 17 at 12:13
0
$\begingroup$

You can make a script like this:

import bpy

max_saves = 4  # if you have that many saved regions, trying to create a new one will throw an error
               # remove old saves to create a new one

save_name = "restore_render_regions_{}.py"

out = "import bpy\n\n"

for name, scene in bpy.data.scenes.items():
    out += f"scene = bpy.data.scenes.get('{name}')\n" \
    f"if scene:\n" \
    f"    scene.render.border_min_x = {scene.render.border_min_x}\n" \
    f"    scene.render.border_max_x = {scene.render.border_max_x}\n" \
    f"    scene.render.border_min_y = {scene.render.border_min_y}\n" \
    f"    scene.render.border_max_y = {scene.render.border_max_y}\n" \
    f"# --\n\n"
    
for i in range(max_saves):
    filename = save_name.format(i)
    if filename not in bpy.data.texts:
        break
else:
    raise MemoryError("Number of saved render region states exceeded the limit - increase the limit or " \
        "remove old saves")
        
file = bpy.data.texts.new(filename)
file.write(out)

Running it will create another script named restore_render_regions_{0}.py with saved region coordinates, so you can run the automatically generated script to restore the coordinates at any time (the Texts are saved with the file).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.