Presentation is loading. Please wait.

Presentation is loading. Please wait.

BRDF models and their use in Global Illumination Algorithms László Szirmay-Kalos.

Similar presentations


Presentation on theme: "BRDF models and their use in Global Illumination Algorithms László Szirmay-Kalos."— Presentation transcript:

1 BRDF models and their use in Global Illumination Algorithms László Szirmay-Kalos

2 Definition of the BRDF = f r (  ’,x,  ) x  ’’  w(  ’,x,  ) cos  Bidirectional Reflectance Distribution Function BRDF: f r (  ’,x,  ) [1/sr]

3 Representation of Measured BRDF data 11 11 22 22 BRDF is a 5-variate function:  1,  1,  2,  2, Table size: 100x100x100x100x10 = 10 9

4 Mathematical BRDF models 11221122 Geometry information extract function1 function2 function n composition frfr  BRDF parameters

5 Properties of BRDFs l 1. Positive: probability times cosine angle l 2. Symmetric (reciprocal) - Helmholtz l 3. Energy conserving: –the reflected energy is less than the incoming energy –the incoming photon is reflected with a probability less than 1 f r (  ’,x,  ) = f r ( ,x,  ’)

6 Albedo l Probability that a photon coming from  ’ is reflected to any direction (not absorbed): l Energy conservation: a(x,  ’) =  w(  ’,x,  ) d   f r (  ’,x,  ) cos  d  a(x,  ’) < 1 ’’ ’’

7 Visibility of the albedo l Reflection of homogenous illumination a(x,  ) =  1=  f r (  ’,x,  ) cos  ’d  ’ ’’ L ref = 1 f r (  ’,x,  ) cos  ’L ref = 1 a(x,  ) 1 1   ’’

8 Physically plausible BRDFs l Positive, symmetric, energy conserving l do not violate physics l make the transport operator a contraction –Proof with the infinite norm: || f ||= max |f | ||  L|| = max  L(h(x,- ,  ) f r cos  ’d  ’  max  f r cos  ’d  ’  max L = max a(x,  )  ||L||

9 Diffuse reflection l Radiance is independent of the out direction l Helmholtz: independent of the in direction l BRDF is constant: f r (  ’,x,  ) = k d ( ) ’’ ’’

10 Lambert’s law l Response to a point-lightsource L ref = L ir k d cos  ’ ’’  ’’ class Diffuse { Color Kd; public: Color BRDF(Vec& L, Vec& N, Vec& V) { return Kd; } Color Albedo( Vec& N, Vec& V ) { return Kd*M_PI; } };

11 Image of diffuse objects

12 Physical plausibility of the diffuse BRDF l Positive: l Symmetric: l Energy conserving: k d < 1/  f r (  ’,x,  ) = k d a(x,  ’) =  k d cos  d  =     k d cos  sin  d  d  = k d 2    cos  sin  d  = k d  dd

13 BRDF of ideal reflection l Radiance is reflected only to the ideal mirror direction l BRDF is a Dirac-delta function: f r (  ’,x,  ) =  r  k r /cos  ’ ’’ ’’ ’’ L ref = L ir k r rr

14 Reflection of ideal mirrors: k r - the Fresnel function F || = F=F= cos  ’ - (n+k j ) cos  cos  ’+ (n+k j ) cos  2 cos  - (n+k j ) cos  ’ cos  + (n+k j ) cos  ’  ’’ n =n = sin  ’ sin  Snellius-Descartes law of refraction n = Relative speed of the wave 2

15 If the light is not polarized k r (,  ’) = F || 1/2 E || + F  1/2 E  2 E || + E  2 F || + F  2 = ’’ ’’ gold silver k r (,  ’)

16 Calculation of reflection direction  r = 2 cos  N -  rr   - N cos   N N cos  Law of reflection: angle of the outgoing light equals to the angle of the incoming light and the incoming beam, outgoing beam and the surface normal are in a single plane. class Reflector { L =  r, V=  Color Kr; public: BOOL ReflectDir(Vec& L, N, V) { L = N * (N * V) * 2 - V; return TRUE; } Color Albedo( Vec& N, Vec& V ) { return Kr; } };

17 BRDF of ideal refraction l Radiance is refracted only to the ideal refraction direction l BRDF is a Dirac-delta function: f r (  ’,x,  ) =  t  k t /cos  ’ ’’ ’’  L refract = L ir k t tt n =n = sin  ’ sin  Snellius-Descartes law of refraction

18 Calculation of refraction direction  t = N (cos  n -  (1- (1 - cos 2  )/ n 2 ) ) -  n tt    -  N cos  N NN N  sin   -Ncos   Ncos  sin  N =N = n =n = sin  Snellius-Descartes law of refraction

19 Refraction class class Refractor { Color Kt; double n; public: BOOL RefractionDir(Vec& L, Vec& N, Vec& V, BOOL out) { double cn = n; if ( !out ) cn = 1.0/cn; double cosa = N * V; // Snellius-Descartes law double disc = 1 - (1 - cosa * cosa) / cn / cn; if (disc < 0) return FALSE; L = N * (cosa / cn - sqrt(disc)) - V / cn; return TRUE; } }; L =  t, V= 

20 BRDF of specular reflection: Phong model ’’  ’r’r ’’  ’r’r = diffuse +  A function is needed that is large at  =0 and decreases rapidly k s cos n 

21 Original Phong model l Not symmetric! L ref = L ir k s cos n  f r (  ’,x,  ) = k s cos n  cos  ’ Lobes of reflected radiance ”Albedo”: Probability of reflection max max/2 90 deg

22 Computation of the ”albedo” of the original Phong ’r’r  a(x,  ’) =  k s cos n  /cos  ’·cos  d      k s cos n  sin  d  d  d  = sin  d  d   Over estimate: directions that go to the object ! In the reflection lobe:  ’   a(x,  ’)  2  k s /(n+1) ·Cutting(1..0.5) dd

23 Reciprocal Phong model f r (  ’,x,  ) = k s cos n  L ref = L ir k s cos n  cos  ’ Lobes of reflected radiance: dark at grazing angles Albedo: 90 deg

24 Computation of the albedo of the reciprocal Phong ’r’r  a(x,  ’) =  k s cos n  cos  d  =     k s cos n  sin  cos  d  d  d  = sin  d  d   Over estimate: directions that go to the object !

25 Albedo of the reciprocal Phong: perpendicular illumination ’r’r a(x,  ’) =  k s cos n  cos  d  =     k s cos n+1  sin  d  d  = a max (x,  ’) = 2  k s /(n+2)    =  !

26 Albedo of the reciprocal Phong: arbitrary illumination, shiny surfaces a(x,  ’) =  k s cos n  cos  d  = cos  ’   k s cos n  d  =  is approximately constant in the reflection lobe and equals to  ’ ’r’r  ’’ a (x,  ’)  2  k s /(n+1) cos  ’ ·Cutting(1..0.5)

27 Reciprocal Phong BRDF class class Phong { Color Ks; double shine; public: Color BRDF(Vec& L, Vec& N, Vec& V) { double cos_in = L * N; if (cos_in > 0 && ks() != 0) { Vec R = N * (2.0 * cos_in) - L; double cos_refl_out = R * V; if (cos_refl_out > 0) return (Ks * pow(cos_refl_out, shine)); } return SColor(0); } Color Albedo(Vec& N, Vec& V) { return ks()*2*M_PI/(shine+2) * (N*V); } };

28 Pumping up the reciprocal Phong l Metals: albedo does not decline at grazing angles f r (  ’,x,  ) = k s cos n  X l X is like cos  ’ but symmetric –X = (cos  ’+ cos  )/2: reflection is 2 times greater at grazing angles than at perpendicular illumination –X = cos  ’·cos  : albedo  at grazing angles –X =  cos  ’·cos  : albedo  at grazing angles

29 Reciprocal and the pumped-up models

30 Max Phong model f r (  ’,x,  ) = k s cos n  max(cos  ’,cos  ) L ref = L ir k s cos n  if  ’ <  L ref = L ir k s cos n  cos  ’/cos  if  ’>  Lobes of reflected radiance max max/2  ’’ 90 deg

31 Modified Phong + Fresnel Rendering: path tracing

32 Cook-Torrance model l Physically based model: surface is a collection of randomly oriented perfect mirrors of the same size f L N V H = (L+V) 0 normal vector of microfacets that can reflect L to V Pr(H) =  exp(-(tan 2  m 2  m 2 cos 2  Beckmann distribution:

33 Cook Torrance reflection probability l Reflection is an AND of the following events: –microfacet met by the photon is properly oriented –no masking and shadowing takes place –photon is not absorbed w(  ’,x,  ) d  = Pr{photon goes to  d  | comes from  ’} x  dd ’’

34 Probability of proper orientation L N V H: (L+V) 0  dA (N·L) f ·(H·L) Pr(H) d    dA/f f f (H·L) Pr(orientation) = dA (N·L) dAdA Visible size of a facet Number of facets Relative number of properly oriented facets Total visible area

35 dddddddd d   = sin   d   d   d  = sin  d  d   =  ,  = 2   d   /d  = sin   /2sin2   = 1/4 cos   = 1/(4(H·L)) Pr(H) Pr(orientation) = 4 (N·L) dd L H V  

36 Probability of masking Pr(not masking) = 1 - l 1 / l 2 = 1- sin(2  +  -90)/sin(90-  ) = 1+cos(2  +  )/cos(  )= L V H l1l1 l2l2 l2l2 N   180-2  90-  2  +  -90 cos(  )+cos(2  +  ) cos(  ) = 2cos(  ) cos(  +  ) cos(  ) (N·H) (N·V) (V·H) (N·H) (N·V) (V·H) (N·H) (N·V) (V·H) Pr(not masking) =min(2,1) L V H

37 Probability of shadowing (N·H) (N·V) (V·H) (N·H) (N·V) (V·H) (N·H) (N·V) (V·H) Pr(no shadow AND no mask) = G(N,L,V)= min(2, 2, 1) (N·H) (N·L) (L·H) Pr(not shadow) =min(2,1) (N·H) (N·L) (L·H) Cheat!!!: albedo is infinite at grazing angles L V H N Symmetry: mask  shadow L  V

38 Cook-Torrance BRDF Pr(not absorb) =F((L·H), ) Fresnel function f r (L,V)=Probability of reflection/d  (N·L) f r (L,V)= ·G(N, L,V) · F((L·H), ) 4(N·V) (N·L) Pr(H)

39 Physically based versus Empirical models l Physically based: –structural validity –difficult to compute: l Cook-Torrance: 21, He-Torrance: 1516 –no importance sampling l Empirical models: –behavioral validity: plausibility + features –simple to compute: Phong: 5, Blinn: 10 –importance sampling

40 Fitting to measurement data ’’ f r (  ’,  ) cos  ’ = L ref / L ir  ’’ L ref L ir f r (  ’,  ) cos  ’=w(  ’, , p 1,p 2,…p m ) e.g.: p 1 =k d, p 2 =k s, p 3 =shine Least square estimate: Find p 1,p 2,…p m by minimizing: E(p 1,…p m )=  (w(  i ’,  i, p 1,…,p m )-F i ) 2 Non-linear system of equations:  E/  p 1 = 0,  E/  p 2 = 0,…,  E/  p m = 0 Measurements:  ’ 1,  1 F 1  ’ 2,  2 F 2 ….  ’ n,  n F n


Download ppt "BRDF models and their use in Global Illumination Algorithms László Szirmay-Kalos."

Similar presentations


Ads by Google