Emulation Modes

Direct3D furnishes three devices that emulate 3-D hardware in software, MMX, RGB, and ramp devices. For details, see MMX Device, RGB Device and Ramp Device. Because these devices perform software emulation, they render more slowly than 3-D hardware. However, if the user's computer has no 3-D hardware support, these software-emulated modes may be sufficient for your application.

MMX and RGB modes provides the full range of capabilities offered by the Direct3D transformation and lighting modules. In these modes, your application can use 8-, 16-, 24-, or 32-bit textures.

Ramp mode utilizes the full range of the transformation module but does not support colored lighting. A ramp mode device uses the Direct3D lighting module for monochrome gray-scale lighting only. Therefore, lights in ramp mode have intensity but no color. The gray-scale value is stored in the blue component of the light color.

Colored materials and textures can be used in ramp mode. Direct3D uses the material or texture color as its base color. If white light (full intensity light) is shining on the material or texture, the base color is used. However, if the light strength is less than full intensity, Direct3D mixes gray or black into the color of the material or texture. If your application uses textures in ramp mode, it must set the D3DLIGHTSTATE_MATERIAL member of the D3DLIGHTSTATETYPE enumerated type. Only 8-bit textures can be used in ramp mode. For details, see Materials and Ramp Mode Lighting.

To control the number of color values available for a material or texture in ramp mode, your application must set the dwRampSize member of the D3DMATERIAL structure when it creates its materials. Direct3D uses the material and texture color as the base color. The value in the dwRampSize member determines how many gradients of the base color are available, depending on the brightness of the light. Direct3D creates a color palette with the number of entries (1-based) specified in the dwRampSize member. Since the maximum possible number of palette entries is less than 256 (256 minus the reserved colors that Windows uses), your application should specify the minimum number of gray-scale values required for the application.

For best results, make the ramp size for most or all of your application's materials the same value. When Direct3D runs out of palette entries, it searches through the existing materials to find the closest color match. Only materials with the same ramp size can be considered a match.