The image compositing utility imf_comp is able to merge several images of identical resolution into a final image based on the alpha channel information of the individual images. Rendering with mental ray using a camera window will result in images of full resolution with only a smaller rectangular part filled with actual content. It allows to render heavy scenes in smaller pieces to save memory, or render very large resolution images in parts that could not be rendered otherwise. The tool can be used afterwards to glue the image pieces together easily and seamlessly. Note, that if global illumination caches are used, like finalgather maps, then those should be pre-computed at full resolution to capture the full scene, and used later in read-only mode for the rendering of the individual tiles. See the example for details.
The image compositing utility is started as
imf_comp [options] file1 [file2 ... fileN]
It reads color image files with an alpha channel, filen, and merges them seamlessly into a final image if the resolution matches. By default, the first input file file1 will be overwritten with the final image.
The following options are supported:
In this example the image should be rendered in 4 smaller
pieces. Assuming that final gathering is enabled, the finalgather
map is computed separately at full image resolution (320 x 240) without actually rendering an image, and
saved to the file
> set FG_OPT=-finalgather_rebuild on -finalgather_file irrad.fgm -- > ray $FG_OPT -finalgather only scene.mi
The 4 image strips are now rendered, selected with the window command line option so that no pixels overlap. To ensure a consistent final gathering result, the precomputed map file is used in read-only freeze mode. mental ray will take care of correctly computing overlapping pixels if image filtering demands it.
> set FG_OPT=-finalgather_rebuild f -finalgather_file irrad.fgm -- > ray $FG_OPT -window 0 0 320 60 -o tile1.tif scene.mi > ray $FG_OPT -window 0 61 320 120 -o tile2.tif scene.mi > ray $FG_OPT -window 0 121 320 180 -o tile3.tif scene.mi > ray $FG_OPT -window 0 181 320 240 -o tile4.tif scene.mi
This resulting images may look like the following, displayed with a checkerboard background to show transparent areas:
Now, the tool imf_comp can be used to composite the images together to form the final full resolution image, like this:
> imf_comp -o image.tif tile1.tif tile2.tif tile3.tif tile4.tif
This is the created image:
If the whole process was successful then the original tiles should not be visible. Note, that transparency information is also preserved.
Copyright © 1986, 2012 NVIDIA Corporation