다음을 통해 공유


확산 조명 맵(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 );

텍스처 사용하여 조명 매핑