Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Wenn sie von einer Lichtquelle beleuchtet werden, erhalten glänzende Objekte , die hoch reflektierende Materialien verwenden, Glanzlichter. In einigen Fällen sind die Glanzlichter, die vom Beleuchtungsmodul erzeugt werden, nicht genau. Um eine ansprechendere Hervorhebung zu erzeugen, wenden viele Direct3D-Anwendungen Glanzlichtzuordnungen auf Grundtypen an.
Um glanzförmige Lichtzuordnung durchzuführen, fügen Sie die Glanzlichtzuordnung zur Textur des Grundtyps hinzu, und modulieren Sie dann die RGB-Lichtkarte (multiplizieren Sie das Ergebnis mit).
Im folgenden Codebeispiel wird dieser Prozess in C++ veranschaulicht.
// This example assumes that d3dDevice is a valid pointer to an
// IDirect3DDevice9 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.
d3dDevice->SetTexture(0, lptexBaseTexture );
// Set the base texture operation and arguments.
d3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE );
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
// Set the specular light map.
d3dDevice->SetTexture(1, lptexSpecLightMap);
// Set the specular light map operation and args.
d3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD );
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT );
// Set the RGB light map.
d3dDevice->SetTexture(2, lptexLightMap);
// Set the RGB light map operation and arguments.
d3dDevice->SetTextureStageState(2,D3DTSS_COLOROP, D3DTOP_MODULATE);
d3dDevice->SetTextureStageState(2,D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(2,D3DTSS_COLORARG2, D3DTA_CURRENT );
Verwandte Themen