SlideShare ist ein Scribd-Unternehmen logo
1 von 20
이민웅
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/

Weitere ähnliche Inhalte

Andere mochten auch

[1126 박민근] 비전엔진을 이용한 mmorpg 개발
[1126 박민근] 비전엔진을 이용한 mmorpg 개발[1126 박민근] 비전엔진을 이용한 mmorpg 개발
[1126 박민근] 비전엔진을 이용한 mmorpg 개발
MinGeun Park
 
TBH Promotieboekje
TBH PromotieboekjeTBH Promotieboekje
TBH Promotieboekje
thebighand
 
Internet decency legislation
Internet decency legislationInternet decency legislation
Internet decency legislation
Tgarmon34
 
Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3
Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3
Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3
Lenka Križanová
 

Andere mochten auch (20)

[1126 박민근] 비전엔진을 이용한 mmorpg 개발
[1126 박민근] 비전엔진을 이용한 mmorpg 개발[1126 박민근] 비전엔진을 이용한 mmorpg 개발
[1126 박민근] 비전엔진을 이용한 mmorpg 개발
 
The Producer
The ProducerThe Producer
The Producer
 
Prezentácia - Študentská spoločnosť STROM (SOŠ hotelových služieb a obchodu, ...
Prezentácia - Študentská spoločnosť STROM (SOŠ hotelových služieb a obchodu, ...Prezentácia - Študentská spoločnosť STROM (SOŠ hotelových služieb a obchodu, ...
Prezentácia - Študentská spoločnosť STROM (SOŠ hotelových služieb a obchodu, ...
 
2013 gep challenge_tim4
2013 gep challenge_tim42013 gep challenge_tim4
2013 gep challenge_tim4
 
TBH Promotieboekje
TBH PromotieboekjeTBH Promotieboekje
TBH Promotieboekje
 
局務會議業務報告 養護工程二科101.1.19
局務會議業務報告 養護工程二科101.1.19局務會議業務報告 養護工程二科101.1.19
局務會議業務報告 養護工程二科101.1.19
 
科長100.08.31 新建工程二科業務報告(all) 林金源 (2)
科長100.08.31 新建工程二科業務報告(all) 林金源 (2)科長100.08.31 新建工程二科業務報告(all) 林金源 (2)
科長100.08.31 新建工程二科業務報告(all) 林金源 (2)
 
1010704
10107041010704
1010704
 
2013 gep challenge_tim12
2013 gep challenge_tim122013 gep challenge_tim12
2013 gep challenge_tim12
 
2012南瀛綠都心迎春花卉展
2012南瀛綠都心迎春花卉展2012南瀛綠都心迎春花卉展
2012南瀛綠都心迎春花卉展
 
第21局局務會議紀錄
第21局局務會議紀錄第21局局務會議紀錄
第21局局務會議紀錄
 
局務會議業務報告 養護工程二科101.2.1
局務會議業務報告 養護工程二科101.2.1局務會議業務報告 養護工程二科101.2.1
局務會議業務報告 養護工程二科101.2.1
 
Internet decency legislation
Internet decency legislationInternet decency legislation
Internet decency legislation
 
Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3
Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3
Innovation and Creativity Camp | Viac ako peniaze Prezentácia č.3
 
100.8.17養護科科務報告
100.8.17養護科科務報告100.8.17養護科科務報告
100.8.17養護科科務報告
 
25 __
25  __25  __
25 __
 
1000831 業務報告
1000831 業務報告1000831 業務報告
1000831 業務報告
 
ภูมิภาคชายฝั่ง
ภูมิภาคชายฝั่งภูมิภาคชายฝั่ง
ภูมิภาคชายฝั่ง
 
(101.08.15日局務會議)2013臺南百花祭先期籌畫報告 2
(101.08.15日局務會議)2013臺南百花祭先期籌畫報告 2(101.08.15日局務會議)2013臺南百花祭先期籌畫報告 2
(101.08.15日局務會議)2013臺南百花祭先期籌畫報告 2
 
Prezentácia - Študentská spoločnosť TOGETHER (Evanjelické gymnázium, Tisovec)
Prezentácia - Študentská spoločnosť TOGETHER (Evanjelické gymnázium, Tisovec)Prezentácia - Študentská spoločnosť TOGETHER (Evanjelické gymnázium, Tisovec)
Prezentácia - Študentská spoločnosť TOGETHER (Evanjelické gymnázium, Tisovec)
 

Mehr von 민웅 이

니시카와젠지의 3 d 게임 팬을 위한 ps4
니시카와젠지의 3 d 게임 팬을 위한 ps4니시카와젠지의 3 d 게임 팬을 위한 ps4
니시카와젠지의 3 d 게임 팬을 위한 ps4
민웅 이
 
니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌
니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌
니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌
민웅 이
 
Wrapped diffuse
Wrapped diffuseWrapped diffuse
Wrapped diffuse
민웅 이
 

Mehr von 민웅 이 (14)

Siggraph15 A Novel Sampling Algorithm for Fast and Stable Real-Time Volume Re...
Siggraph15 A Novel Sampling Algorithm for Fast and Stable Real-Time Volume Re...Siggraph15 A Novel Sampling Algorithm for Fast and Stable Real-Time Volume Re...
Siggraph15 A Novel Sampling Algorithm for Fast and Stable Real-Time Volume Re...
 
PowerVR Low Level GLSL Optimisation
PowerVR Low Level GLSL Optimisation PowerVR Low Level GLSL Optimisation
PowerVR Low Level GLSL Optimisation
 
제노블레이도 2 ray marching을사용한 구름 표현
제노블레이도 2 ray marching을사용한 구름 표현제노블레이도 2 ray marching을사용한 구름 표현
제노블레이도 2 ray marching을사용한 구름 표현
 
자동 동적 3차원 입체시각
자동 동적 3차원 입체시각자동 동적 3차원 입체시각
자동 동적 3차원 입체시각
 
Compute shader DX11
Compute shader DX11Compute shader DX11
Compute shader DX11
 
니시카와젠지의 3 d 게임 팬을 위한 ps4
니시카와젠지의 3 d 게임 팬을 위한 ps4니시카와젠지의 3 d 게임 팬을 위한 ps4
니시카와젠지의 3 d 게임 팬을 위한 ps4
 
니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌
니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌
니시카와젠지의 3 d게임 팬을 위한「gravity daze」그래픽스 강좌
 
Wrapped diffuse
Wrapped diffuseWrapped diffuse
Wrapped diffuse
 
3D Engine Tools with C++/CLR
3D Engine Tools with C++/CLR3D Engine Tools with C++/CLR
3D Engine Tools with C++/CLR
 
Light in screen_space(Light Pre Pass)
Light in screen_space(Light Pre Pass)Light in screen_space(Light Pre Pass)
Light in screen_space(Light Pre Pass)
 
Gamma and linear color-space
Gamma and linear color-spaceGamma and linear color-space
Gamma and linear color-space
 
Cheap realisticskinshading kor
Cheap realisticskinshading korCheap realisticskinshading kor
Cheap realisticskinshading kor
 
Ceh
CehCeh
Ceh
 
Deferred decal
Deferred decalDeferred decal
Deferred decal
 

Microfacet brdf

  • 2.  불투명한 surface 에서의 반사율을 표현하기 위한 함수 i 는 input 을 의미하고 o 는 output 을 의미 광원 카메라 출처 : http://lifeisforu.tistory.com/11 함수는 들어 오는 빛 방향인 와, 나가는 빛 방향인 를 취하며, 둘 다 표면 법선인 n 에 상대적이다. 그리고 이 함수는 를 따라 나가면서 반사되는 표면상의 irradiance incident 에 대한 로부터의 복사열radiance 을 반환한다. 각 방향 w 는 자체적으로 azimuth angle 인 와 zenith angle 인 에 의해 매개변수화되어 있으며, 결국 BRDF 는 전체적으로 4 차 함수이다
  • 3.  Reciprocity (상반적): BRDF(f) 연산에서 입사광 방 향(l) 과 반사광 방향(r) 은 입사와 반사의 방향이 바뀌어도 그 결과가 동일하다. 예를 들어 f(l,r) = f(r,l)  에너지 보존: 반사광의 총 에너지는 입사광의 에 너지 과 같거나 작다
  • 4.  물리 기반의 specular BRDF 는 한 면이 각각의 normal(m)에 따라 한방향으로 만 반사되는 다수 의 극소면으로 구성 되어 있다는 극소면 이론 (micro-facet theory)을 기반으로 하고 있음 l 방향에서 들어온 빛은 시선 방향 v 로 반사 되며 극소면의 normal 인 m 은 l 과 v 의 half 백터와 동일하다
  • 5.  Microfacets ◦ 임의의 포하는 ◦ 정반사 버트의 ◦ 난반사 리얼타임랜더링 2nd 참고 크기와 각도를 가지면서 표면상에 불규칙하게 분 (가우시안 분포) 작고 평평한 거울집합 모델 : 일부 microfacet에서 빛이 직접 반사 → 램 법칙에 따라서 모델 : 여러 개의 facet들끼리 상호 반사
  • 6.
  • 7.  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 항은 한 극소면이 다른 극소면을 얼마나 가로막 는 가를 설명하는데 사용
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. 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

Hinweis der Redaktion

  1. “No Fresnel” uses the base reflectance (which for most materials is quite low) for all angles.
  2. This version uses the correct (for highlights) “x=(l dot h)” term for the Shlick approximation. This is a very specific term – it only kicks in when both the view and lighting directions form large angles with the surface normal. So you can see that it brightens the reflections in a selective manner compared to “no Fresnel”.
  3. Here highlight Fresnel uses the “x=(n dot v)” term, which is correct for mirror reflections but incorrect for point light highlights. This term is too non-specific, and brightens up the highlights all over the scene whenever the surface normal is glancing to the view direction.“No Fresnel” is actually closer to the correct image.