1) PBR (Physical Based Rendering) 이란 ?
: 표면의 재질에 따른 빛의 반사가 물리적으로 어떻게 이루어지는지 시뮬레이션하여 그래픽을 표현하는 기법.
: 빛의 물리적 현상을 조금 더 "과학적인 관점으로 분석한 개념"
( PBR 등장 이후 기존의 렌더링 방식을 "레거시 렌더링(Legacy Rendering)"이라고 함)
2) 레거시 렌더링 vs PBR
a) 난반사광 (Diffuse Lighting) : 컬러를 만드는 반사
: 레거시 렌더링은 추상적인 관점으로 난반사광을 별로도 분리해서 구현
: 눈에 보이는이미지를 그대로 텍스쳐로 사용하며, 이것을 난반사(Diffuse) 텍스쳐라고 함.
b) 정반사광 (Specular Lighting) : 표면의 각도에 따른 반사
: 레거시 렌더링에서는 GrayScale의 Environment Map을 이용하여 유사 정반사광을 구현 or Mask Map을 이용하여 정반사(Specular)텍스쳐를 제작하고 픽셀 단위 라이팅을 적용해서 구현하는 방식.
: 또는 별도의 텍스쳐를 사용하지 않고 광원의 위치와 표면각에 따라 광원이 반사되는 수치를 입력하는 방법으로 구현.
: PBR에서는 재질이 금속석(Metallic)을 가질수록 빛 자체를 더 만ㅁㅎ이 반사하게 된다는 현상에 입각해, 재질의 금속성 값이 어느 정도인지 수치로 입력하는 방법을 사용함.
c) 전반사광 (Total Reflection) : 표면 거칠기에 따른 반사의 선명도
: 모든 표면은 거칠기(Roughness)를 가지고 있으며 거칠기 정도에 따라 표면의 반사 정도가 반비례하는 데 거칠지 않고 매끈할수록 마치 거울과 같은 전반사(Total Reflection) 성질을 띠며 표면이 거칠수록 그 반사의 선명한 정도가 줄어듦.
: 레거시 렌더링에서는 실제 표면의 거칠기와는 무관하게 작업자가 반사재질을 지니게 만들고 싶은 파트에 대해 해당표면이 전반사 속성을 적용/비적용으로 구분함.
: 주변 환경을 맵으로 사용해서 마치 주변이 오브젝트에 반사되는 것처럼 눈속임을 하거나, 반사될 장면을 한번 더 렌더링 해서 실시간 반사를 구현하는 방법을 사용.
: PBR에서도 전반사의 구현방식은 동일하나, 표면의 거칠기 정도에 따라서 해당표면의 전반사성이 반비례되는 값을 조절하는 방법을 사용함.
위의 3가지가 기본적인 재질에 대한 빛의 물리적 반사 현상을 시뮬레이션 하는 부분이 변경된 것이며, 재질과 질감에 관련된 핵심요소가 됩니다.
이 외에도 굴절(Refraction), 왜곡(Distortion), 프레넹(Fresnel)과 같은 옵션이 추가로 들어갈 수 있으나, 이는 레거시와 PBR 모두 적용 가능한 부분임.
3) 대표적인 쉐이딩의 종류 (+PBR)
a) 퐁(Phong) 쉐이딩 (Blinn - Phong)
: 각각의 화소컬러에 조명과 음영을 계산하는 픽셀당 기법: 오브젝트 단위 렌더링 → 텍스쳐의 질감, 투명도. 범프 효과를 정교하게 표현
: 폴리곤으로 되어 있는 각진 면을 부드럽게 처리하는데 효과적인 셰이딩 기법(고라우드 셰이딩 발전형)으로 폴리곤 모서리의 노멀갑 자체를 보간 하고 스페큘러와 반사가 추가된 방식
: 하이라이트가 언제나 동그랗게 맺히며 평평한 면에서는 스페큘러를 표현하지 못함. 원형 물체에 한해서 스페큘러 표현이 좋음.
: 스페큘러 방식과 라이팅에 조금씩 차이에 따라 블린, 램버트, 비등방성 셰이딩 등 유사 파생 셰이더가 존재함
: 만약 제작된 폴리곤이 깨지는 것 처럼 보인다면 오브젝트의 노멀 방향이 엉뚱한 방향으로 향하고 있기 때문.
b) 램버트(Lambert) 쉐이딩
: 밸브의 하프라이프(1998년) 에 처음 사용된 기법. Dot(라이트벡타, 법선벡터) 로 제작.
: 법선 벡터가 곱해지면서 표면에 굴곡진 라이팅을 생성합니다.
: 램버트 셰이딩에 블린 퐁 방식의 스페큘러를 더해지면 매끄러운 재질의 플라스틱 표현에 매우 적합해 짐.
- 램버트 셰이딩의 큰 문제중 뚜렷한 명암차이를 해결하기 위해 개량된 라이팅 기술 - 하프라이프 2 에서 사용됨
- 기존 공식에 라이팅 값을 0.5 를 곱하고 0.5를 더해서 최소 밝기가 0.5 만큼은 보장해 주는 방식
- (램버트 라이팅Dot(L,N) * 0.5f) + 0.5f 로 표현됨. 라이트가 없을 경우 빛이 0.5 만큼은 존재 하는것 처럼 나옴.
- 이 경우엔 밝은 부분은 넓고 어두운 영역은 너무 좁아져서 이를 해결하기 위해 계수를 곱함.
Pow((Dot(L,N) ( 0.5f + 0.5f , n) 인데, 일반적으로 n 은 4 를 입력합니다. 여러번 제곱해 줌으로서 콘트라스트를 올려주는 방식.
c) NPR(비사실적 렌더링) 쉐이딩
: 비 비사실적이지만 라이트가 되는 텍스쳐를 표면에 매핑 하거나 임의로 각도를 틀어가며 렌더링을 하는 셰이딩 기법.
: 매우 다양한 방식이 존재하며 비 현실적인 아트 표현으로는 매우 적절한 기법. 카툰 렌더링도 여기에 해당
d) PBR(물리기반 렌더링)
: 물리 현상을 기반으로 구축된 셰이딩 기법. 대표적인 사례로 2006년도에 나온 기어 오브 워에서 사용되었고 현재는 여러 게임들에 거쳐서 폭 넓게 사용되고 있다.
- 현재 까지 나와있는 셰이더에서 생략된 물리 현상들을 좀 더 많이 구현한 셰이더.
- 적은 텍스쳐 리소스와 셰이더 하나로 거의 모든 재질을 표현할 수 있음. (단 최소 요구 텍스쳐 리소스 양은 많은 편)
- 다양한 조명 환경에서도 안정적으로 결과물이 생성되며 디퍼드 렌더러에서 사용하여도 매우 적합한 모델.