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

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

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

BRDF models and their use in BRDF models and their use in Global Illumination AlgorithmsGlobal Illumination Algorithms

László Szirmay-Kalos

Definition of the BRDFDefinition of the BRDF

= fr (’,x,)

x

’ w(’,x,) cos

Bidirectional Reflectance Distribution FunctionBRDF: fr (’,x,) [1/sr]

Representation of Measured Representation of Measured BRDF dataBRDF data

1

12

2

BRDF is a 5-variate function:1 , 1 , 2 , 2 ,

Table size: 100x100x100x100x10 = 109

Mathematical BRDF modelsMathematical BRDF models

1

1

2

2

Geometryinformation

extract

function1

function2

function n

composition fr

BRDF parameters

Properties of BRDFsProperties of BRDFs

1. Positive: probability times cosine angle 2. Symmetric (reciprocal) - Helmholtz

3. Energy conserving: – the reflected energy is less than the incoming energy

– the incoming photon is reflected with a probability less than 1

fr (’,x,) = fr (,x,’)

AlbedoAlbedo

Probability that a photon coming from ’ is reflected to any direction (not absorbed):

Energy conservation:

a(x,’) =w(’,x,) dfr (’,x,) cos d

a(x, ’) < 1’ ’

Visibility of the albedoVisibility of the albedo

Reflection of homogenous illumination

a(x,) = 1= fr (’,x,) cos ’d’

Lref = 1 fr (’,x,) cos ’ Lref = 1 a(x,)

11

Physically plausible BRDFsPhysically plausible BRDFs

Positive, symmetric, energy conserving do not violate physics make the transport operator a contraction

– Proof with the infinite norm: || f ||= max |f |

||L|| = max L(h(x,-,) fr cos ’d’

max fr cos ’d’ max L = max a(x,) ||L||

Diffuse reflectionDiffuse reflection

Radiance is independent of the out direction

Helmholtz: independent of the in direction

BRDF is constant: fr (’,x,) = kd()

’ ’

Lambert’s lawLambert’s law Response to a point-lightsource

Lref = Lir kd 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; }};

Image of diffuse objectsImage of diffuse objects

Physical plausibility of the Physical plausibility of the diffuse BRDFdiffuse BRDF

Positive: Symmetric: Energy conserving: kd < 1/

fr (’,x,) = kd

a(x,’) = kd cos d= kd cos sin dd =

kd 2 cos sin d = kd

d

BRDF of ideal reflectionBRDF of ideal reflection

Radiance is reflected only to the ideal mirror direction

BRDF is a Dirac-delta function: fr (’,x,) = r kr /cos’

’ ’’

Lref = Lir krr

Reflection of ideal mirrors:Reflection of ideal mirrors:

kkrr - the Fresnel function - the Fresnel function

F|| = F =cos ’ - (n+k j ) coscos’+ (n+k j ) cos

2cos - (n+k j ) cos’

cos+ (n+k j ) cos’

n =sin’sin

Snellius-Descarteslaw of refractionn = Relative speed of the wave

2

If the light is not polarizedIf the light is not polarized

kr (, ’) =F||

1/2 E|| + F

1/2 E 2

E|| + E 2

F||+ F

2=

’gold silver

kr (, ’) kr (, ’)

Calculation of reflection directionCalculation of reflection direction

r = 2 cos N -

r

- Ncos

- NcosN

Ncos

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; }};

BRDF of ideal refractionBRDF of ideal refraction Radiance is refracted only to the ideal

refraction direction

BRDF is a Dirac-delta function: fr (’,x,) = t kt /cos’

’ ’

Lrefract = Lir kt

t

n =sin’sin

Snellius-Descarteslaw of refraction

Calculation of refraction Calculation of refraction directiondirection

t = N (cosn -(1-(1-cos2 )/n2))- n

t

- NcosN

NNsin

-NcosNcos

sinN =

n =sin sin

Snellius-Descarteslaw of refraction

Refraction classRefraction classclass 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=

BRDF of specular reflection: BRDF of specular reflection: Phong modelPhong model

’r

’r

= diffuse +

A function is needed that is large at =0 and decreases rapidly ks cosn

Original Phong modelOriginal Phong model

Not symmetric!

Lref = Lir ks cosn fr(’,x,) = ks cosn cos’

Lobes of reflected radiance

”Albedo”:Probability of reflection

max

max/2

90 deg

Computation of the ”albedo” of Computation of the ”albedo” of the original Phongthe original Phong

’r

a(x,’) = kscosn/cos’·cosd

ks cosnsin d d

d = sin d d

Over estimate: directions that go to the object !

In the reflection lobe: ’

a(x,’) 2 ks /(n+1) ·Cutting(1..0.5)

d

Reciprocal Phong modelReciprocal Phong model

fr(’,x,) = ks cosn Lref = Lir ks cosn cos’

Lobes of reflected radiance:dark at grazing angles

Albedo:

90 deg

Computation of the albedo of Computation of the albedo of the reciprocal Phongthe reciprocal Phong’r

a(x,’) = kscosncosd=

ks cosnsincos d d

d = sin d d

Over estimate: directions that go to the object !

Albedo of the reciprocal Phong: Albedo of the reciprocal Phong: perpendicular illuminationperpendicular illumination

’r

a(x,’) = kscosncosd=

ks cosn+1sind

d=

amax(x,’) = 2 ks /(n+2)

= !

Albedo of the reciprocal Phong: Albedo of the reciprocal Phong: arbitrary illumination, shiny surfacesarbitrary illumination, shiny surfaces

a(x,’) =

kscosncosd=

cos’kscosnd=

is approximately constant inthe reflection lobe and equals to ’’r

a (x,’) 2 ks /(n+1) cos’ ·Cutting(1..0.5)

Reciprocal Phong BRDF classReciprocal Phong BRDF classclass 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); }};

Pumping up the reciprocal PhongPumping up the reciprocal Phong

Metals: albedo does not decline at grazing angles

fr(’,x,) = ks cosn X 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

Reciprocal and the Reciprocal and the pumped-up modelspumped-up models

Max Phong modelMax Phong model

fr(’,x,) = ks cosn max(cos’,cos)Lref = Lir ks cosn if ’ <

Lref = Lir ks cosncos’/cos if ’>

Lobes of reflected radiance

maxmax/2

90 deg

Modified Phong + FresnelModified Phong + FresnelRendering: path tracingRendering: path tracing

Cook-Torrance modelCook-Torrance model

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 thatcan reflect L to V

Pr(H) =

exp(-(tan2 m2m2 cos2

Beckmann distribution:

Cook Torrance reflection Cook Torrance reflection probabilityprobability

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’

Probability of proper orientationProbability of proper orientation

L

NV

H: (L+V)0

dA (N·L)

f ·(H·L) Pr(H) ddA/f

f

f (H·L)

Pr(orientation) = dA (N·L)

dAVisible sizeof a facet

Numberof facets

Relative numberof properly oriented facets

Total visible area

dddd

d = sin dd

d = sin dd = , = 2

d/d= sin /2sin2 = 1/4 cos = 1/(4(H·L))

Pr(H)Pr(orientation) =

4 (N·L)d

L

H

V

Probability of maskingProbability of masking

Pr(not masking) = 1 - l1 / l2 = 1- sin(2+-90)/sin(90-) = 1+cos(2+)/cos()=

L

V

H

l1

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)

LV H

Probability of shadowingProbability 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 infiniteat grazing angles

L VH

NSymmetry: mask shadow

L V

Cook-Torrance BRDFCook-Torrance BRDF

Pr(not absorb) =F((L·H) , ) Fresnel function

fr(L,V)=Probability of reflection/d(N·L)

fr(L,V)= ·G(N, L,V) · F((L·H) , ) 4(N·V) (N·L)

Pr(H)

Physically based versus Physically based versus Empirical modelsEmpirical models

Physically based:

– structural validity

– difficult to compute: Cook-Torrance: 21, He-Torrance: 1516

– no importance sampling Empirical models:

– behavioral validity: plausibility + features

– simple to compute: Phong: 5, Blinn: 10

– importance sampling

Fitting to measurement dataFitting to measurement data

fr (’,) cos ’ = Lref / Lir

LrefLir fr (’,) cos ’=w(’,, p1,p2,…pm)

e.g.: p1=kd, p2=ks, p3 =shine

Least square estimate:

Find p1,p2,…pm by minimizing:E(p1,…pm)= (w(i’,i, p1,…,pm)-Fi )2

Non-linear system of equations:E/p1 = 0, E/p2 = 0,…,E/pm = 0

Measurements:’1,1 F1

’2,2 F2

….’n,n Fn