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

컬러 조명 맵


일반적으로, 컬러 조명 맵을 사용하면, 3D 장면을 보다 리얼하게 렌더링 할 수 있다. 컬러 조명 맵은, 조명 정보로서 라이트 맵의 RGB 데이터를 사용한다.

다음의 C++ 코드는, RGB 컬러 데이터를 사용한 라이트 맵핑을 나타내고 있다.

// This example assumes that d3dDevice is a valid pointer to an
// IDirect3DDevice9 interface and that lptexLightMap is a valid
// pointer to a texture that contains RGB light map data.

// Set the light map texture as the first texture.
d3dDevice->SetTexture(0, lptexLightMap);

d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );

이 예에서는, 라이트 맵을 최초의 텍스처로서 설정해 있다. 그 다음에, 최초의 혼합 스테이지의 스테이트를 설정해, 입력 텍스처 데이터를 곱셈하고 있다. 또, 최초의 텍스처와 기본도형의 현재 컬러를 곱셈 처리용의 인수로서 사용하고 있다.



© 2002 Microsoft Corporation. All rights reserved.
↑TOP