Microfacet BRDF

Download Report

Transcript Microfacet BRDF

이민웅
Shader Study

불투명한 surface 에서의 반사율을 표현하기 위한
함수
i 는 input 을 의미하고 o 는 output 을 의미
광원
카메라
출처 : http://lifeisforu.tistory.com/11
함수는 들어 오는 빛 방향인 와,
나가는 빛 방향인 를 취하며,
둘 다 표면 법선인 n 에 상대적이다.
그리고 이 함수는 를 따라 나가면서
반사되는 표면상의 irradiance incident 에
대한
로부터의 복사열radiance 을 반환한다.
각 방향 w 는 자체적으로 azimuth angle 인 와
zenith angle 인 에 의해 매개변수화되어 있으며,
결국 BRDF 는 전체적으로 4 차 함수이다

Reciprocity (상반적): BRDF(f) 연산에서 입사광 방
향(l) 과 반사광 방향(r) 은 입사와 반사의 방향이
바뀌어도 그 결과가 동일하다. 예를 들어 f(l,r) =
f(r,l)

에너지 보존: 반사광의 총 에너지는 입사광의 에
너지 과 같거나 작다

물리 기반의 specular BRDF 는 한 면이 각각의
normal(m)에 따라 한방향으로 만 반사되는 다수
의 극소면으로 구성 되어 있다는 극소면 이론
(micro-facet theory)을 기반으로 하고 있음
l 방향에서 들어온 빛은 시선 방향 v 로 반사 되며 극소면의 normal 인 m 은 l 과 v 의 half 백터와 동일하다

Microfacets
◦ 임의의
포하는
◦ 정반사
버트의
◦ 난반사
리얼타임랜더링 2nd 참고
크기와 각도를 가지면서 표면상에 불규칙하게 분
(가우시안 분포) 작고 평평한 거울집합
모델 : 일부 microfacet에서 빛이 직접 반사 → 램
법칙에 따라서
모델 : 여러 개의 facet들끼리 상호 반사

Fresnel Term
◦ 일반적인 Schlick approximation 을 사용
 Fresnel (and the Schlick approximation) is originally
defined for mirror reflections, and uses the angle between
the light (or view) direction and surface normal.

Distribution Term
◦ 분산 항은 주어진 방향 주변에 극소면 normal 이 어떻게
만들어지는지를 결정하는데 사용

Geometry Term (Visibility functions)
◦ Geometry 항은 한 극소면이 다른 극소면을 얼마나 가로
막는 가를 설명하는데 사용
float3 diffuse = saturate(?dot(?normal,?light_direction?)?) * light_colour;
float3 diffuse = n_dot_l * light_colour;
float3 specular = (PI / 4.0f) * specular_term * cosine_term * fresnel_term * visibility_term * light_colour
//Specular Term
float normalisation_term = ( specular_power + 2.0f ) / 2.0f * PI;
float blinn_phong = pow( n_dot_h, specular_power );
// n_dot_h is the saturated dot product of the normal and half vectors
float specular_term = normalisation_term * blinn_phong;
//Cosine Term
float cosine_term = n_dot_l;
//Fresnel Term
float base = 1.0f - h_dot_l;
// Dot product of half vector and light vector. No need to saturate as it can't go above 90 degrees
float exponential = pow( base, 5.0f );
float fresnel_term = specular_colour + ( 1.0f - specular_colour ) * exponential;
//Visibility Term
float alpha = 1.0f / ( sqrt( PI_OVER_FOUR * specular_power + PI_OVER_TWO ) );
float visibility_term = ( n_dot_l * ( 1.0f - alpha ) + alpha ) * ( n_dot_v * ( 1.0f - alpha ) + alpha );
// Both dot products should be saturated
visibility_term = 1.0f / visibility_term;
//Performance/Quality Trade-off
float3 slow_hardware_specular = specular_term * cosine_term * light_colour;
float3 mid_hardware_specular = specular_term * cosine_term * fresnel_term * light_colour;
float3 fast_hardware_specular = specular_term * cosine_term * fresnel_term * visibility_term * l



http://simonstechblog.blogspot.com/2011/1
2/microfacet-brdf.html
http://blog.naver.com/hsg556?Redirect=Log
&logNo=110129600105
http://altdevblogaday.com/2011/08/23/sha
der-code-for-physically-based-lighting/