There are three kinds of gamma values which can be set via the 3ds Max preferences dialog. These values can be set and accessed
using a global instance the GammaMgr class called gammaMgr defined in the file gamma.h.
- Display Gamma - This describes the gamma of your monitor. Typically, this will be 2.2 when using an sRGB monitor with default
settings. This can be accessed or set using the methods GammaMgr::GetDisplayGamma() and GammaMgr::SetDisplayGamma(). If you need the display color value corresponding to a given physical space color, with the display gamma applied you can
use the GammaMgr::DisplayGammaCorrect() method.
- Input Gamma - This is the default gamma used when reading bitmaps. This value is used to linearize the data of an image.
Typically, this will be 2.2, as well. This can be overridden by a user while the bitmap is loaded to be a custom value, or
to be the embedded bitmap value (e.g. in .TGA or .PNG files). This can be accessed or set using the methods GammaMgr::GetFileInGamma() and GammarMgr::SetFileInGamma().
- Output Gamma - This describes the gamma used when saving images. This should be 1.0 if you the user is saving to linear floating-point
image formats, or plans to do compositing work on the images. If the user just want images for display purposes (i.e. such
as to create a .JPG from 3ds Max) then this would probably be 2.2. This can be accessed or set using the methods GammaMgr::GetFileOutGamma() and GammarMgr::SetFileOutGamma().
Gamma correction can be enabled or disabled via the method GammaMgr::Enable(), and the state can be queried using the method GammaMgr::IsEnabled().
When input gamma is changed in the Preferences dialog, the system broadcasts NOTIFY_BITMAP_CHANGED. This message should be handled by any plug-in handling bitmaps which need to be updated as a result (e.g. Bitmap Textures).
When display gamma is changed in the preferences dialog the system calls UpdateGammaTable() on every BitmapStorage object in memory, and calls RefreshWindow() on every bitmap object. This causes every bitmap and their display windows to refresh. There is no system-wide notification.
No refresh or notification occurs automatically when you call GammaMgr::SetDisplayGamma(). The method BitmapStorage::UpdateGammaTable() must be called for each loaded bitmap when gamma settings are changed programmatically, to ensure that Bitmap::GetLinearPixels() returns correct information at all times.