DirectX Graphics 프로그래밍 가이드 고정 기능 파이프라인 텍스처 텍스처 혼합 텍스처에 의한 라이트 맵핑 디퓨즈 라이트 맵   [목차열람] [주소복사] [슬롯비우기]
디퓨즈 라이트 맵
 
Microsoft DirectX 9.0

디퓨즈 라이트 맵


광원에서 비추었을 때, 광택이 없는 표면은 디퓨즈 라이트를 추방한다. 디퓨즈 라이트의 빛남은, 광원으로부터의 거리, 표면 법선과 광원의 방향 벡터와의 각도에 따라서 다르다. 조명 계산에 의해 시뮬레이트 하는 디퓨즈 라이트의 이펙트는 일반적인 것이다.

텍스처 라이트 맵을 사용해 디퓨즈 라이트를 시뮬레이트 할 수 있다. 이것을 실시하려면 , 다음의 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 );


© 2002 Microsoft Corporation. All rights reserved.
↑TOP