When illuminated by a point light source, shiny surfaces, such as metal or color light maps, your Direct3D applications can apply specular light maps to primitives.
To perform specular light mapping, first modulate the specular light map with the primitive's existing texture. Then add the monochrome or RGB light map. The following code fragment illustrates this process:
// This example assumes that lpD3DDev is a valid pointer to an
// IDirect3DDevice3 interface.
// lptexBaseTexture is a valid pointer to a texture.
// lptexSpecLightMap is a valid pointer to a texture that contains RGB
// specular light map data.
// lptexLightMap is a valid pointer to a texture that contains RGB
// light map data.
// Set the base texture.
lpD3DDev->SetTexture(0,lptexBaseTexture );
// Set the base texture operation and args
lpD3DDev->SetTextureStageState(0,D3DTSS_COLOROP,
D3DTOP_MODULATE );
lpD3DDev->SetTextureStageState(0,D3DTSS_COLORARG1, D3DTA_TEXTURE );
lpD3DDev->SetTextureStageState(0,D3DTSS_COLORARG2, D3DTA_DIFFUSE );
// Set the specular light map.
lpD3DDev->SetTexture(1,lptexSpecLightMap );
// Set the specular light map operation and args
lpD3DDev->SetTextureStageState(1,D3DTSS_COLOROP,
D3DTOP_MODULATE );
lpD3DDev->SetTextureStageState(1,D3DTSS_COLORARG1, D3DTA_TEXTURE );
lpD3DDev->SetTextureStageState(1,D3DTSS_COLORARG2, D3DTA_CURRENT );
// Set the RGB light map.
lpD3DDev->SetTexture(2,lptexLightMap);
// Set the RGB light map operation and args
lpD3DDev->SetTextureStageState(2,D3DTSS_COLOROP, D3DTOP_ADD);
lpD3DDev->SetTextureStageState(2,D3DTSS_COLORARG1, D3DTA_TEXTURE );
lpD3DDev->SetTextureStageState(2,D3DTSS_COLORARG2, D3DTA_CURRENT );