Keywords: main

Next: 1.21 Output Shaders Up: 1. Functionality Previous: 1.19 OpenGL Acceleration

# 1.20 Color Calculations

All colors in mental ray are given in the RGBA color space and all internal calculations are performed in RGBA. The alpha channel is used to determine transparency; 0 means fully transparent and 1 means fully opaque. mental ray uses premultiplied colors, which means that the R, G, and B components are scaled by A and may not exceed A. Optionally, RGBA colors may be stored in the output image in non-premultiplied form to increase the precision of highly transparent pixels, but internally mental ray and all shaders work with premultiplied colors. Premultiplication is used to simplify compositing operations.

Internally, colors are not restricted to the unit cube in RGB space. As a final step before output, colors are clipped using one of two methods. By default, the red, green and blue values are simply truncated. Optionally, colors may be clipped using a desaturation method which maintains intensity (if possible), but shifts the hue towards the white axis of the cube. Desaturation color clipping may be selected with either the `-desaturate on` option on the command line or `desaturate on` in the options block in the scene. The alpha channel is always truncated.