Delen via


Diffuse Lichtkaarten (Direct3D 9)

Wanneer deze wordt verlicht door een lichtbron, geven matte oppervlakken diffuse lichtspiegeling weer. De helderheid van diffuus licht hangt af van de afstand van de lichtbron en de hoek tussen het oppervlak normaal en de lichtbronrichtingsvector. De diffuse belichtingseffecten die door verlichtingsberekeningen worden gesimuleerd, produceren alleen algemene effecten.

Uw toepassing kan complexere diffuse verlichting simuleren met patroonlichtkaarten. Doe dit door de diffuse light-kaart toe te voegen aan het basispatroon, zoals wordt weergegeven in het volgende C++-codevoorbeeld.

// 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 );

lichte toewijzing met patronen