When operating in 8-bit mode, 3ds Max uses a 256 color palette. Plugins should avoid changing the system palette because this can cause the quality of the 3ds Max display to degrade. The palette used by 3ds Max reserves the bottom 10 slots and top 10 slots of the palette for Windows colors. It also contains a 6x6x6 RGB color cube, and a 16 gray level ramp. This palette should be adequate for most purposes. When a plugin wants to output bitmaps and colored areas with dither, so as to get good approximations of 24 bit colors in 8-bit modes, it should make use of the GPort class. The GPort also provides access to 8 "animated palette slots" to allow dynamically altering system palette entries.
This section discusses several class that are helpful in working with 3ds Max palettes and paletted images.
GPort
- This class has several purposes. It maintain the default 3ds Max palette for doing 256 color graphics. It also provides a mechanism for allocating "animated color slots" in the default palette for use in the user interface. Additionally it provide various functions for doing dithered graphics using the default 3ds Max palette. There is one instance of GPort
that is shared globally. It is accessed by the function GetGPort()
.Quantizer
- This class is used for dithering output to files. This class computes a palette when going from 24-bit to 8-bit color.ColorPacker
- This class is used to pack the pixels down using the Quantizer computed palette.