Diffuse Lichtkarten (Direct3D 9)
Wenn sie von einer Lichtquelle beleuchtet wird, zeigen matte Oberflächen diffuse Lichtspiegelung an. Die Helligkeit des diffusen Lichts hängt vom Abstand von der Lichtquelle und dem Winkel zwischen der Oberfläche normal und dem Vektor der Lichtquellenrichtung ab. Die durch Beleuchtungsberechnungen simulierten diffusen Beleuchtungseffekte erzeugen nur allgemeine Effekte.
Ihre Anwendung kann komplexere diffuse Beleuchtung mit Texturlichtzuordnungen simulieren. Fügen Sie dazu die diffuse Lichtzuordnung zur Basistextur hinzu, wie im folgenden C++-Codebeispiel gezeigt.
// This example assumes that d3dDevice is a valid pointer to an
// IDirect3DDevice9 interface.
// lptexBaseTexture is a valid pointer to a texture.
// lptexDiffuseLightMap is a valid pointer to a texture that contains
// RGB diffuse light map data.
// Set the base texture.
d3dDevice->SetTexture(0,lptexBaseTexture );
// Set the base texture operation and args.
d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,
D3DTOP_MODULATE );
d3dDevice->SetTextureStageState(0,D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(0,D3DTSS_COLORARG2, D3DTA_DIFFUSE );
// Set the diffuse light map.
d3dDevice->SetTexture(1,lptexDiffuseLightMap );
// Set the blend stage.
d3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE );
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT );
Verwandte Themen