Bitmap Gamma Overview

Perceptual and Physical Space

The bitmap gamma is used to convert between perceptual space and physical space representation of images. The precise usage of gamma depends on the kind of bitmap.

When a bitmap is loaded from disk into 3ds Max, the memory representation of a bitmap is as it is stored on disk. When a bitmap is the result of a render the memory representation will always be in physical space.

When saving a bitmap to disk:

GetLinearPixels()

The function Bitmap::GetLinearPixels() is expected to return a representation of the pixels in physical space.

When the system gamma correction is on (i.e. gammaMgr.IsEnabled() returns TRUE) then if the bitmap is in perceptual space, it performs an inverse gamma using the input gamma. If the system gamma correction is off, or the bitmap is already in physical space then Bitmap::GetLinearPixels() returns the pixels as is. Bitmap::GetPixels()returns pixels as they are represented in memory (usually perceptual space).

The Two BitmapInfo Gamma Values

A BitmapInfo struct contains two gamma values: the file gamma and the custom gamma.

The method BitmapInfo::GetEffectiveGamma() will return either the custom gamma or file gamma, depending on the flags set in the bitmap.