Normal Map을 통해 빛에 따라 텍스쳐가 더 사실적으로 표현할 수 있었는데
Height Map을 이용하면 Vertex 자체에 굴곡을 넣을 수 있다.
float height = g_heightTexture.SampleLevel(g_sampler, input.texcoord, 0).r;
height = height * 2.0 - 1.0;
pos += float4(output.normalWorld * height * heightScale, 0.0);
Vertex Shader에서 SampleLevel로 HeightMap의 r값을 가져오면(흑백 텍스쳐이기 때문에 rgb 어떤 값도 가능)
height를 구할 수 있다. NormalMap처럼 0~1 범위를 -1~1범위로 바꿔주고 정점의 위치를 normalWorld 방향으로
height만큼 더해주면 된다.
'그래픽스' 카테고리의 다른 글
| [그래픽스] HDR 파이프라인 (0) | 2023.07.22 |
|---|---|
| [그래픽스] HDRI(High Dynamic Range Image) (0) | 2023.07.22 |
| [그래픽스] Normal Mapping (0) | 2023.07.21 |
| [그래픽스] Mipmap, LOD (0) | 2023.07.21 |
| [그래픽스] Hull Shader, Tessellation, Domain Shader (0) | 2023.07.21 |