Upload
-
View
685
Download
6
Embed Size (px)
DESCRIPTION
Citation preview
Microfacet BRDF이민웅
Shader Study
불투명한 surface 에서의 반사율을 표현하기 위한 함수
BRDF ( 양방향 반사분포함수 )
i 는 input 을 의미하고 o 는 output 을 의미
함수는 들어 오는 빛 방향인 와 , 나가는 빛 방향인 를 취하며 , 둘 다 표면 법선인 n 에 상대적이다 . 그리고 이 함수는 를 따라 나가면서 반사되는 표면상의 irradiance incident 에 대한 로부터의 복사열 radiance 을 반환한다 . 각 방향 w 는 자체적으로 azimuth angle 인 와 zenith angle 인 에 의해 매개변수화되어 있으며 , 결국 BRDF 는 전체적으로 4 차 함수이다
출처 : http://lifeisforu.tistory.com/11
카메라
광원
Reciprocity ( 상반적 ): BRDF(f) 연산에서 입사광 방향 (l) 과 반사광 방향 (r) 은 입사와 반사의 방향이 바뀌어도 그 결과가 동일하다 . 예를 들어 f(l,r) = f(r,l)
에너지 보존 : 반사광의 총 에너지는 입사광의 에너지 과 같거나 작다
물리적으로 타당한 BRDF 의 조건
물리 기반의 specular BRDF 는 한 면이 각각의 normal(m) 에 따라 한방향으로 만 반사되는 다수의 극소면으로 구성 되어 있다는 극소면 이론 (micro-facet theory) 을 기반으로 하고 있음
물리적으로 타당한 BRDF 의 조건
l 방향에서 들어온 빛은 시선 방향 v 로 반사 되며 극소면의 normal 인 m 은 l 과 v 의 half 백터와 동일하다
Microfacets◦ 임의의 크기와 각도를 가지면서 표면상에 불규칙하게
분포하는 ( 가우시안 분포 ) 작고 평평한 거울집합◦ 정반사 모델 : 일부 microfacet 에서 빛이 직접 반사 →
램버트의 법칙에 따라서◦ 난반사 모델 : 여러 개의 facet 들끼리 상호 반사
Microfacet BRDF
리얼타임랜더링 2nd 참고
Microfacet BRDF
Fresnel Term◦ 일반적인 Schlick approximation 을 사용
Fresnel (and the Schlick approximation) is originally defined for mirror reflections, and uses the angle be-tween the light (or view) direction and surface nor-mal.
Distribution Term◦ 분산 항은 주어진 방향 주변에 극소면 normal 이
어떻게 만들어지는지를 결정하는데 사용 Geometry Term (Visibility functions)
◦ Geometry 항은 한 극소면이 다른 극소면을 얼마나 가로막는 가를 설명하는데 사용
Microfacet BRDF
Beckmann Distribution functionBeckmann Distribution function
Blinn-Phong Distribution func-tionBlinn-Phong Distribution func-tion
No FresnelNo Fresnel
Correct FresnelCorrect Fresnel
Incorrect FresnelIncorrect Fresnel
No Visibility functionNo Visibility function
Schlick-Smith Visibility functionSchlick-Smith Visibility function
Kelemen Visibility functionKelemen Visibility function
Cook-Torrance Visibility functionCook-Torrance Visibility function
Schlick-Smith Visibility functionSchlick-Smith Visibility function
Kelemen Visibility functionKelemen Visibility function
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 Termfloat 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 vectorsfloat specular_term = normalisation_term * blinn_phong;
//Cosine Termfloat cosine_term = n_dot_l;
//Fresnel Termfloat 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 degreesfloat exponential = pow( base, 5.0f );float fresnel_term = specular_colour + ( 1.0f - specular_colour ) * exponential;
//Visibility Termfloat 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 saturatedvisibility_term = 1.0f / visibility_term;
//Performance/Quality Trade-offfloat3 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/12/microfacet-brdf.html
http://blog.naver.com/hsg556?Redirect=Log&logNo=110129600105
http://altdevblogaday.com/2011/08/23/shader-code-for-physically-based-lighting/
Reference