다음을 통해 공유


확산 조명 맵(Direct3D 9)

광원에 의해 조명되면 무광택 표면은 확산 조명 반사를 표시합니다. 확산 조명의 밝기는 광원에서의 거리 및 표면 법선과 광원 방향 벡터 사이의 각도에 따라 달라집니다. 확산 조명 효과는 일반 효과로만 생성되는 조명 계산으로 시뮬레이션됩니다.

애플리케이션에서 텍스처 조명 맵을 사용하여 더 복잡한 확산 조명을 시뮬레이션할 수 있습니다. 다음 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 );

텍스처를 사용하여 조명 매핑