5
$\begingroup$

I tried to render a file at %1000 res first my mouse locked up then it returned to normal, blender entered the render screen but never started rendering. after about 10 mins blender crashed and quit. Is it possible to render a image this good, would having a better PC help, could my PC have run out of free RAM(I think it has 2 GB).

$\endgroup$
11
$\begingroup$

If you want to render scenes that require more memory then your system has, I think your best option is to render the image in sections (tiles).

I think there are more then one script to do this, but I found one here: http://blenderscripting.blogspot.com.au/2011/07/calculate-tile-render-ratio-snippet.html


Update: made an improved version of the script linked above:

This uses environment variables so you don't have to do manual edits to the file to change settings.

Example usage:

TILE_X=10 TILE_Y=10 PERCENT=1000 blender -b /path/to.blend -P render_tiles.py

You can also save the file with very high resolution and omit the PERCENT var
(which will be set to 100).

Once completed, the montage command to join the images is printed.
This depends on ImageMagick's montage command, eg:

Run this command to join images:
    montage -tile 10x10 -border 0 -mode concatenate '/tmp/render_*.*' final.png

Heres the script: render_tiles.py

def main():
    import os
    import bpy
    from bpy import context

    scene = context.scene
    render = scene.render

    tiles_x = int(os.environ.get("TILE_X", "4"))
    tiles_y = int(os.environ.get("TILE_Y", "4"))
    resolution_percentage = int(os.environ.get("PERCENT", "100"))

    slice_x = 1.0 / tiles_x
    slice_y = 1.0 / tiles_y

    # use border and crop
    render.use_border = True
    render.use_crop_to_border = True

    # set resolution percentage
    render.resolution_percentage = resolution_percentage

    filepath_orig = render.filepath

    # track progress
    tiles_done = 0
    tiles_total = tiles_x * tiles_y

    for div_y in range(tiles_x):
        for div_x in range(tiles_y):

            render.border_min_x = slice_x * div_x
            render.border_max_x = slice_x * (div_x + 1)
            render.border_min_y = 1.0 - (slice_y * (div_y + 1))
            render.border_max_y = 1.0 - (slice_y * div_y)

            cell_name = "%04d_%02d_%02d" % (tiles_done + 1, div_x + 1, div_y + 1)

            render.filepath = "%s_%s" % (filepath_orig, cell_name)

            bpy.ops.render.render(write_still=True)

            print("Rendered %s (%d of %d)" % (cell_name, tiles_done, tiles_total))

            tiles_done += 1

    print("Finished: %d tiles" % tiles_done)

    print("Run this command to join images:")
    print("    montage -tile %dx%d -border 0 -mode concatenate %r final.png" %
          (tiles_x, tiles_y, bpy.path.abspath(filepath_orig) + "*.*" ))


if __name__ == "__main__":
    main()
$\endgroup$
  • $\begingroup$ This def saved my day sir. Just curious, when I render an image of super high res (e.g., 250k by 250k pixels) on a large-memory machine, I encounter no memory issue, but the rendering never finishes even one sample. Blender uses all CPUs (3600% CPUs) at first and later on goes back to 100% CPUs. Any idea why this happened? $\endgroup$ – Sibbs Gambling Feb 23 at 23:10

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.