光源によって照らされると、マット サーフェスには拡散光の反射が表示されます。 拡散光の明るさは、光源からの距離と、サーフェス法線と光源方向ベクトルの間の角度によって異なります。 照明計算によってシミュレートされた拡散光効果は、一般的な効果のみを生成します。
アプリケーションでは、テクスチャ ライト マップを使用して、より複雑な拡散光をシミュレートできます。 これを行うには、次の C++ コード例に示すように、拡散光マップをベース テクスチャに追加します。
// 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 );
関連トピック
-
テクスチャ を使用したライト マッピングの