A Blender Addon to manage renders with Render Region. This addon divides the render of a project into regions and allows you to render all or only some of them.
Useful in several cases, for example:
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 3.4.0, in Ubuntu 20.04 and Windows 10.
To merge all images from script (created by this addon) imagemagick and python 3 must be installed.
Blender version: 3.4.
control_render_regions.py
in the blender scripts/addons folder on your system (linux: ~/.config/blender/2.81/scripts/addons/)Edit > Preferences > Add-ons
, and enable "Render: Control Render Region"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:
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.
Selecting "Create bash and python script" the "render region" button will not launch the renders, but will write a script (.sh bash script in Linux and MacOS, .bat batch script in Windows), and a python script in the output folder.
The bash script launches renders of the selected regions. 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; is commented. To launch the images cropping/appending procedure after rendering, uncomment the line with the command "python name of blender project.py". In .bat it will be: "::python xxxx.py" and in .sh: "#python xxxx.py"; in both cases it must become: "python xxxx.py"
The python script crops and merges all regions to get the final image.
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.
Control Render Region is distributed under the terms of the GNU General Public License, version 3