본문 바로가기
그래픽스ㆍDirectX

[DirectX 11] Phong Shading

by imagineer_jinny 2023. 9. 25.

본 내용은 <그래픽스 새싹코스  - 홍정모> 강의를 토대로 작성하였습니다. honglab에서 강의를 구매하실 수 있습니다.

 

Phong reflection model

- 조명이 빛을 반사해서 우리 눈에 어떻게 보이는 지에 대한 모델

- 물체가 조명을 받았을 때  Ambient + Diffuse + Specular로 표현

 

 

Diffuse

어떤 표면의 normal vector →n과 조명을 향하는 벡터인  →l이 있을 경우

빛을 받는 강도는 두 벡터의 각도와 관련이 있다

 

각도가 작으면 작을수록 빛을 많이 받고 크면 클수록 적게 받음각도가 0일 때 가장 값이 크다 → cos를 사용한다

 

구현 예시

const vec3 dirToLight= glm::normalize(light.pos - hit.point);
const float diff = glm::max(glm::dot(hit.normal,dirToLight),0.0f);

 

Specular

반짝거리는 느낌을 살릴 때 사용

반짝거린다 = 표면이 매끈하다

아주 매끈한 표면을 가정함

 

 

 

 

참고

Phong reflection model - Wikipedia

 

Phong reflection model - Wikipedia

From Wikipedia, the free encyclopedia Shading algorithm in computer graphics The Phong reflection model (also called Phong illumination or Phong lighting) is an empirical model of the local illumination of points on a surface designed by the computer graph

en.wikipedia.org

 

댓글