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

스펙큐러 라이트 맵


광원에서 비추었을 때에 빛나는 개체 (반사성의 높은 머트리얼을 사용하는 개체)는, 스펙큐러 하이라이트를 받는다. 경우에 따라서는, 조명 모듈로 생성된 스펙큐러 하이라이트는 정확하지 않은 경우도 있다. 보다 효과적인 하이라이트를 생성하기 위해서, 많은 Microsoft® Direct3D® 애플리케이션에서는 원시적으로 스펙큐러 라이트 맵을 적용한다.

스펙큐러 라이트 맵핑을 실행하려면 , 스펙큐러 라이트 맵을 기본도형의 텍스처에 추가해, 그 결과와 RGB 라이트 맵을 곱셈한다.

다음 샘플 코드는, C++ 에서의 이 처리를 나타내고 있다.

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

// Set the base texture.
d3dDevice->SetTexture(0, lptexBaseTexture );

// Set the base texture operation and arguments.
d3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE );
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );

// Set the specular light map.
d3dDevice->SetTexture(1, lptexSpecLightMap);

// Set the specular light map operation and args.
d3dDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD );
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT );

// Set the RGB light map.
d3dDevice->SetTexture(2, lptexLightMap);

// Set the RGB light map operation and arguments.
d3dDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_MODULATE);
d3dDevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_TEXTURE );
d3dDevice->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_CURRENT );


© 2002 Microsoft Corporation. All rights reserved.
↑TOP