home << prev next >> contents  


Frame Buffers

mental ray can generate more than one type of image. There are up to five main frame buffers: for RGBA, depth, normal vectors, motion vectors, and labels. The depth, normal vector, motion vector, and label frame buffers store the Z coordinate, the normal vector, the motion vector, and the label of the frontmost object at each sample of the image. If multiple samples are taken for a pixel, the frame buffer value for that pixel may be either any one sample value, or a blend of all samples. The number and type of frame buffers to be rendered is controlled by output statements. Output statements specify what is to be done with each frame buffer. If a frame buffer is not listed by any output statement, it is not rendered (except for RGBA, which always exists). If color profiles are used for rendering, then the color frame buffer will always use full floating point representation. There are two types of output statements, those specifying output shaders and those specifying files to write.

There are also additional user-defined frame buffers that can be defined with any data type, using a frame buffer statement in the options block. Up to mental ray version 3.3, only eight user-defined frame buffers could be allocated. This limitation has been removed.

mental ray versions up to 3.3 store frame buffers in memory. mental ray 3.3 uses a more efficient storage format that prevents memory usage from growing while rendering proceeds. mental ray 3.4 and later store frame buffers in frame buffer files on disk to conserve memory, using memory mapping to avoid the overhead of actually storing data on rotating media if memory allows it. Frame buffer files are stored in the directory specified with the -fb_dir command line option; if none is given the directory specified in the TMPDIR or TEMP environment variables is used.

Frame buffer files permit very large frame buffers, or very large numbers of frame buffers, without being limited by available physical memory. The frame buffers must, however, fit into the virtual memory address space of the process as well as into the available disk space. A problem with mapping large files is that the file can occupy a significant portion of your application virtual address space. The address space for a single process is for example limited to up to 4 gigabytes on most 32 bit architectures, with some portions of that space reserved for various system frameworks and libraries. If you try to map a very large file, you might find that there is not enough room to map the entire file. This problem can also occur if you map too many files into the process space.

The storage of frame buffers in memory mapped files on disk can be disabled with the command line option -fb_virtual off.

This introduces an incompatibility for output shaders. The list of frame buffer is no longer available as a fixed array in the state, so output shaders need to be rewritten for mental ray 3.4 to use special frame buffer access functions.

Frame buffer files are removed from disk when rendering has finished.

home << prev next >> contents  


Copyright © 1986-2007 by mental images GmbH