A Blender Addon to manage renders with Render Region. Works with two methods, "divide" or "multiply": "divide" divides the render into regions and allows you to render all regions or just some; with the "multiply" method the render resolution is multiplied by the indicated value and the render is divided into regions, all with the original resolution.
Useful in several cases, for example:
The main goal is to create scripts to launch the render from the terminal, but it is also possible to render from the addon, although in this way it cannot automate the merging of the regions.
To merge all images from the script created by this addon imagemagick and python 3 must be installed.
The regions are rendered top to bottom left to right, so the first one will be the top left and the last one will be the bottom right. You can add margins to regions to have overlapping areas: this way you can avoid problems due to denoise in cycles or effects in the compositor, for example "glare", when merging regions.
Tested with Cycles and Eevee with Blender 4.2.0, in Ubuntu 24.04 and Windows 10.
(the "Output path" field must be set correctly)
This addon is set by default to create scripts, to launch the render from the terminal.
Selecting "Create bash and python script" the "render region" button write a script, for launch the renders, (.sh bash script in Linux and MacOS, .bat batch script in Windows), and a python script, for merging all images, in the output folder.
The bash script launches renders of the selected regions, creating a temp python script for set the region to render. In the script there are commands for all rendering; the regions not to be rendered are commented out. At the end of the script is the command to run the python script. If you do not want to start the process of merging all the renderings, you must comment out the line with the python command:
The python script crops (if overlap margins have been set) and merges all regions to get the final image.
There are two methods: Divide and Multiply
The render is divided into regions according to the values indicated in the "Columns" and "Rows" fields. "Columns" indicates how many parts the width of the render is divided into, while "Rows" indicates the division of the height. The "regions to render" field indicate the regions to render.
For example:
-- Method: Divide -- "Columns": 2 and "Rows": 3 -- regions to render: all
Obviously it is better to avoid dividing the render into regions that would have non-integer numbers: 1920 in 2 regions (960):ok; 1920 in 3 regions (640):ok; 1920 in 7 regions (274.28...) no.
The resolution, X and Y, is multiplied by the value indicated in "multipler" and the render is divided into regions, all with the original resolution Example:
This addon can be used with both Cycles and Eevee, but with Cycles there are problems using "Denoise" (Tab Render Properties > Sampling panel > Render - Denoise check): the "denoise" produces artifacts along the edges of the image, usually only for single pixels along the edges: by merging the images these artifacts will be clearly visible as they are all close and aligned. Other possible problems during merging can be given by effects in compositor, such as the "glare" which adds a halo around the brightest pixels: if these pixels are located near the edge of the region the effect will add the halo which may be larger than the edge distance and therefore be cut off. Combining the images you will see the halo cut out.
To fix this problem, the regions need to be enlarged by adding a margin which will then be cropped before merging the images.
Since the regions are calculated in a relative way and not in pixels, it is difficult to find a value for the margin compatible with the render size, because you have to avoid rounding problems that would affect the render size.
The button "Calculate Margins" finds the largest margin, starting from the value in "Max Margin" going backwards, which generates values with fewer decimals, safer.
The first best values found are written in the "w" and "h" fields. Any other values are reported in the terminal.
If no safe values are found, 0 is returned. In this case you need to change the rendering size, or the number of regions, or increase the "Max Margin" value.
You can choose the value of the margins without calculating it with the "Calculate margins" button, but rounding errors will be possible.
The "Create Reference Image" button generates a reference image (using imagemagick); region borders are drawn with red lines, and margins (or overlapping areas) with semi-transparent areas. All regions are numbered.
If the scene uses the compositor and there are "file output" nodes, the script will modify the names of each slot by adding the indication of the region they belong to. For example:
this name will be changed to "comp2_3x2_0_0" for the first render, "comp2_3x2_0_1" for the second render, and so on. The python script that merges all the renders should also merge the renders from the File Output Node.
If Compositor is activated and there are "File output"nodes, the file name will be changed according to the name assigned to the region.
Control Render Region is distributed under the terms of the GNU General Public License, version 3
limit resolution of reference image
This extension requests the following permission:
Create script to render from terminal and render image
os
module.context.scene
without specifying name so that it always works in active scene./tmp\
which is default in Blender, or leave it empty. It needs to cancel operator and notify users about reason when that happens.I'm curious about how exactly do you use those scripts it creates in your production. Do you append them in Blenders text editor and run from there? I'm not too familiar with background rendering unfortunately.
Hi 1- added Files permission for create script and render image 2- I didn't find where I was directly calling the scene, but I revised the procedure: now it calls the scene active at the moment of file creation or render launch: in this way, even if the scene is switched before saving the project, the render refers to the right scene, even if launched from the terminal. 3- now it checks if the path has been set correctly, it does not accept an empty path or "/tmp" which would give errors: in this case it stops with a message. 4- the image is created with Imagemagick, now if it is not there the user is warned
Scripts must be launched from the terminal, not from inside Blender, precisely to avoid having to launch the complete program.
Scripts to launch renders from the terminal are useful when you have to manage complex projects or very large renders: in these cases it is useful to save resources, even just by not loading the Blender interface.
Furthermore, if only a small detail is modified in the scene, it is not necessary to redo the entire render, but just relauch the relative region. Another case: if the render lasts a long time and we know that it could happen that we have to turn off the computer, for any reason, it is possible to resume the render by launching only the missing regions. Furthermore, with scripts it is possible to launch the render via ssh on other computers.
Alright everything is correct now. I would advise to mention that lines are not visible in Blender in image descriptions so users don't expect that like I did, or maybe show them with GPU? Could be useful. Up to you.
Sign in to comment.
Ready for review