Fundamentals of Rendering - Reflectance Functions CMPT 461/761 Image Synthesis Torsten Möller
Reading Chapter 8 of Physically Based Rendering by Pharr&Humphreys Chapter 16 in Foley, van Dam et al. Chapter 15 in Glassner 2
Components of Photorealistic Rendering Transport of light Transport problem: photons are transported from light sources through the scene Global problem: each point might illuminate any other point Interaction between light and matter Computation of visibility Result: incident light at each point Scene description Geometry: surfaces, volumes Light sources (see Chapter 12) Description of surface properties, reflection properties (see Chapter 5) File formats: RenderMan, DXF, VRML, 3DS, etc. 3
Generic Framework Acquisition Light Transport Visual Display Observer Modeling Measurements Global Illum. Algorithms Tone Mapping Operators Human Perception Geometry BRDFs Lights Textures Radiometric Values Image [Greenberg et al. 97] 4
Surface Reflectance Measured data Gonioreflectometer (See the Cornell Lab) Phenomenological models Intuitive parameters Most of graphics Simulation Know composition of some materials simulate complicated reflection from simple basis Physical (wave) optics Using Maxwell s equations Computationally expensive Geometric optics Use of geometric surface properties 5
BRDF Measurement Sensor Gonioreflectometer Dense sampling of pairs of directions Large table of measurement data Two different principal configurations: Sensor Light source Light sourc e Sample Sample 6 [Images: M. Goesele, Minicourse at IMPA, 2005]
BRDF Measurement cont. [Image: Cornell Lab] 7
Surface Reflectance Diffuse Scatter light equally in all directions E.g. dull chalkboards, matte paint Glossy specular Preferred set of direction around reflected direction E.g. plastic, high-gloss paint Perfect specular E.g. mirror, glass Retro-reflective E.g. velvet or earth s moon 8
Types of Surface Reflectance Types represented by different classes of BRDFs Reflection at (vicinity of) surface Polished surface: specular Rough microstructure: more diffuse character Also reflection within material Diffuse Translucency (see Chapter 4) 9
Surface Reflectance Iso-tropic vs. anisotropic If you turn an object around a point -> does the shading change? 10
Surface Properties Reflected radiance is proportional to incoming flux and to irradiance (incident power per unit area). dl o ( p,ω o ) de( p,ω i ) 11
The BSDF Bidirectional Scattering Distribution Function: Measures portion of incident irradiance (E i ) that is reflected as radiance (L o ) Or the ratio between incident radiance (L i ) and reflected radiance (L o ) f r f r f r p,ω o,ω i ( ) ( p,ω o,ω ) i = dl o( p,ω o ) de( p,ω i ) ( p,ω o,ω ) i = dl o( p,ω o ) de( p,ω i ) = dl o ( p,ω o ) L i ( p,ω i )cosθ i dω i 12
The BRDF and the BTDF Bidirectional Reflectance Distribution Function (BRDF) Describes distribution of reflected light Bidirectional Transmittance Distribution Function (BTDF) Describes distribution of transmitted light BSDF = BRDF + BTDF 13
Illumination via the BxDF The Reflectance Equation L o ( p,ω o ) = f r p,ω o,ω S 2 i The reflected radiance is the sum of the incident radiance over the entire (hemi)sphere foreshortened scaled by the BxDF ( ) L i ( p,ω i )cosθ i dω i 14
Parameterizations 6-D BRDF f r (p, ω o, ω i ) Incident direction ω i Reflected/Outgoing direction ωo Surface position p: textured BxDF 4-D BRDF f r (ω o, ω i ) Homogeneous material Anisotropic, depends on incoming azimuth e.g. hair, brushed metal, ornaments 15
Parameterizations 3-D BRDF f r (θ o, θ i, φ o φ i ) Isotropic, independent of incoming azimuth e.g. Phong highlight 1-D BRDF f r (θ i ) Perfectly diffuse e.g. Lambertian 16
BxDF Property 0 Ranges from 0 to (strictly positive) Infinite when radiance distribution from single incident ray f r ( p,ω o,ω ) i = dl o( p,ω o ) de( p,ω i ) = dl o ( p,ω o ) L i ( p,ω i )cosθ i dω i 17
BRDF Property 1 Linearity of functions Sillion, Arvo, Westin, Greenberg 18
BRDF Property 2 Helmholtz Reciprocity f r (ω o, ω i ) = f r (ω i, ω o ) Materials are not a one-way street Incoming to outgoing pathway same as outgoing to incoming pathway 19
BRDF Property 3 Isotropic vs. anisotropic f r (θ i, φ i, θ o, φ o ) = f r (θ o, θ i, φ o φ i ) Reciprocity and isotropy f r (θ o, θ i, φ o φ i ) = f r (θ i, θ o, φ i φ o ) = f r (θ o, θ i, φ o φ i ) 20
BRDF Property 4 Conservation of Energy Materials must not add energy (except for lights) Materials must absorb some amount of energy When integrated, must add to less than one Reflected light Incoming light Surface 21
Reflectance Reflectance ratio of reflected to incident flux Is between 0 and 1 (p) = d o(p) d i (p) = 3x3 set of possibilities for Ω: f r (p, p, i )L i (p, i ) cos i cos o d i d o L i (p, i ) cos i d i { dω i,ω i,h i } { dω o,ω o,h o } If L is isotropic and uniform there is a clear relationship between ρ and Φ. 22
Reflectance Hemispherical-directional reflectance Reflection in a given direction due to constant illumination over a hemisphere Total reflection over hemisphere due to light from a given direction (reciprocity) Also called albedo - incoming photon is reflected with probability less than one ρ hd ( p,ω o ) = 1 π H 2 (n ) f r ( p,ω o,ω i )cosθ i dω i 23
Reflectance Hemispherical-hemispherical reflectance Constant spectral value that gives the fraction of incident light reflected by a surface when the incident light is the same from all directions ρ hd ( p) = 1 π H 2 (n ) H 2 (n ) f r (p,ω o,ω i )cosθ o cosθ i dω o dω i 24
Representations Tabulated BRDF s Require dense sampling and interpolation scheme Factorization Into two 2D functions for data reduction (often after reparameterization) Basis Functions (Spherical Harmonics) Loss of quality for high frequencies Analytical Models Rough approximation only Very compact Most often represented as parametric equation (Phong, Cook-Torrance, etc.) 25
Construction of BRDF BRDF models for ideal reflection types Ideal diffuse Ideal specular Phenomenological and ad-hoc models Phong and Blinn-Phong Ward, Lafortune, Ashikhmin, Schlick, etc. Often with a few parameters that are fitted to measurements Physics-based local illumination models Simulation of surface and electrodynamics Torrance-Sparrow (Cook-Torrance) Directly from measured data Gonioreflectometer How to represent large amounts of data efficiently? Spherical harmonics, separable representations 26
Law of Reflection Angle of reflectance = angle of incidence I N R + I ( ) = 2cosθN = 2 I N R = I 2( I N)N ( ) ω r = R ω i,n R ϕ i ϕ r θ i θ r ( )N p θ r = θ i ϕ r = ϕ i + π ( )mod2π 27
Polished Metal 28
Ideal Reflection (Mirror) BRDF cast as a delta function ( ) ( ) L i θ i,ϕ i θ i θ r L r θ r,ϕ r L r ( r, r ) = L i ( r, r ± ) f r ( i, i, r, r ) = (cos i cos r ) cos i ( i r ± ) L r ( r, r ) = p f r ( i, i, r, r )L i ( i, i ) cos i d cos i d i (cos i cos r ) = ( i r ± )L i ( i, i ) cos i d cos i d i cos i = L i ( r, r ± ) 29
Snell s Law ηi, ηt indices of refraction (ratio of speed of light in vacuum to the speed of light in the medium) η i sinθ i = η t sinθ t I η i N I = η t N T N ω t = T ω i,n ( ) θ i ϕ i ϕ r p θ t T ϕ r = ϕ i + π ( )mod2π 30
Law of Refraction Starting at Snell s law: We conclude that Assuming a normalized T: Solving this quadratic equation: Leads to the total reflection condition: η i η t N I = N T ( ) = 0 N T µi T = µi + γn ( ) T 2 =1= µ 2 + γ 2 + 2µγ I N γ = µ I N ( ) ± 1 µ 2 1 ( I N) 2 = µcosθ i ± 1 µ 2 sin 2 θ i ( ) 1 µ 2 ( 1 ( I N) 2 ) 0 = µcosθ i ± cosθ o 31
Optical Manhole Total Internal Reflection For water ηw = 4/3 Livingston and Lynch 32
Fresnel Reflection At top layer interface Some light is reflected, Remainder is transmitted through Simple ray-tracers: just given as a constant Physically based - relative contrib. depends on incident angle Polarization of light (dispersion effects) wavelength Solution of Maxwell s equations to smooth surfaces Dielectrics vs. metals (conductors) 33
Fresnel Reflection - Dielectrics Objects that don t conduct electricity (e.g. glass) Fresnel term F for a dielectric is proportion of reflection (e.g. glass, plastic) grazing angles: 100% reflected (almost mirror-like) normal angles: 5% reflected (see the material well!) 34
Fresnel Reflection - Dielectrics Polarized light: r = η t cosθ i η i cosθ t η t cosθ i + η i cosθ t Where ω t is computed according to Snell s law Unpolarized light: r = η i cosθ i η t cosθ t η i cosθ i + η t cosθ t F r ω i ( ) = 1 2 r F t ω i ( 2 2 + r ) ( ) ( ) = 1 F ( r ω ) i 35
Fresnel Reflection - Dielectrics 36
Fresnel Reflection - Conductor Typically metals No transmission Absorption coefficient k 37
Fresnel Reflection - Conductor Polarized light: Unpolarized light: ( r 2 = η2 + k 2 )cos 2 θ i 2ηcosθ i +1 ( η 2 + k 2 )cos 2 θ i + 2ηcosθ i +1 ( ) 2ηcosθ i + cos 2 θ i ( η 2 + k 2 ) + 2ηcosθ i + cos 2 θ i r 2 = η2 + k 2 F r ω i ( ) = 1 2 r ( 2 2 + r ) 38
Fresnel Reflection - Conductor How to determine k or η? Measure Fr for θi=0 (normal angle) 1. Assume k = 0 r 2 = r 2 = η 1 η +1 2. Assume η = 1 ( ) 2 ( ) 2 r 2 = r 2 = k 2 k 2 + 4 η = 1+ F ( r 0) 1 F ( r 0) k = 2 F r 0 ( ) 1 F r 0 ( ) 39
Fresnel Normal (Dielectric) 10% reflected Air 90% transmitted Material 40
Fresnel Grazing (Dielectric) 90% reflected Air 10% transmitted Material 41
Fresnel Mid (Dielectric) 60% reflected Air 40% transmitted Material 42
Fresnel Reflection Conductor (Aluminum) Dielectric (N=1.5) Schlick Approximation: F( θ) = F( 0) + 1 F( 0) ( ) 1 cosθ ( ) 5 43
Fresnel Reflection Example - Copper color shift as θ goes from 0 to π/2 at grazing, specular highlight is color of light π /2 θ λ Measured Reflectance Approximated Reflectance 44
Ideal Specular - Summary Reflection: f r Transmission: ( ) ( p,ω i,ω o ) = F r ( ω i ) δ ω i R( ω o,n) cosθ i f t ( ) = η 2 o p,ω i,ω o η i 2 ( ) ( 1 F r( ω i )) δ ω o T( ω i,n) cosθ i 45
Ideal Diffuse Reflection Uniform Sends equal amounts of light in all directions Amount depends on angle of incidence Perfect all incoming light reflected no absorption f r (ω i,ω o ) k d 46
Layered Surface Varnish Dye Layer 47
Layered Surface Larger Varnish Dye Particles 48
L o,d (ω o ) = M = Ideal Diffuse Reflection Ω f r,d (ω i,ω r )L i (ω i )cosθ i dω i = f r,d L i (ω i )cosθ i dω i Ω = f r,d E Ω L o,d (ω o )cosθ o dω o = L o,d cosθ o dω o Ω = L o,d π Lamberts Cosine Law: M = ρ d E = ρ d E s cosθ s ρ d = M E = L o,dπ E f r,d = ρ d π = f r,d Eπ E = f r,d π 49
Diffuse Helmholtz reciprocity? Energy preserving? ρ d 1 f r,d = ρ d π 1 π 50
Reflectance Models Ideal Diffuse Specular Ad-hoc: Phong Classical / Blinn Modified Ward Lafortune Microfacets (Physically-based) Torrance-Sparrow (Cook-Torrance) Ashikhmin 51
Classical Phong Model L o ( p,ω o ) = ( k ( d N ω ) i + k ( s R( ω o,n) ω ) e ) L ( p,ω ) i i i Where 0<k d, k s <1 and e>0 Cast as a BRDF: R ω o,n f r (p,ω i,ω o ) = k d + k s Not reciprocal Not energy-preserving ( ) e ( ) ω i ( N ω ) i Specifically, too reflective at glancing angles, but not specular enough But cosine lobe itself symmetrical in ω i and ω o 52
Blinn-Phong Like classical Phong, but based on half-way vector H( ω o,ω i ) N ( N ω i ) ( ) = norm( ω o + ω i ) f r (p,ω i,ω o ) = k d + k s ω h = H ω o,ω i Implemented in OpenGL Not reciprocal Not energy-preserving ( ) e Specifically, too reflective at glancing angles, but not specular enough But cosine lobe itself symmetrical in ωi and ωo 53
Phong Illumination Model cont. BRDF for Phong illumination 54
Phong Illumination Model cont. Illustration of ambient, diffuse, and specular components Different angles of incident light 55
Modified Phong ( ) f r (p,ω i,ω o ) = k d π + k s e + 2 2π ( R( ω o,n) ω ) e i For energy conservation: k d + k s < 1 (sufficient, not necessary) Peak gets higher as it gets sharper, but same total reflectivity 56
Ward-Phong Based on Gaussians f r (p,ω i,ω o ) = k d π + k s cosθ i cosθ o exp tan2 ω h α 2 4πα 2 α: surface roughness, or blur in specular component. 57
Ward Model Properties Can be extended to an anisotropic model Phenomenological model, but pretty close to experimental measurements Conservation of energy Can be inverted analytically 58
Lafortune Model Phong cosine lobes symmetrical (reciprocal), easy to compute Add more lobes in order to match with measured BRDF How to generalize to anisotropic BRDFs? weight dot product: f r (p,ω i,ω o ) = k d π + nlobes i=1 ω or i ω i ( ) e i 59
Physically-based Models Some basic principles common to many models: Fresnel effect Surface self-shadowing Microfacets Different physical models required for different kinds of materials Some kinds of materials don t have good models Remember that BRDF makes approximation of completely local surface reflectance! To really model well how surfaces reflect light, need to eventually move beyond BRDF 60
Cook-Torrance Model Based in part on the earlier Torrance-Sparrow model, but adds wavelength dependence of Fresnel term Neglects multiple scattering f r (p,ω i,ω o ) = F r( ω h )D( ω h )G ω o,ω i 4 cosθ i cosθ o D - Microfacet Distribution Function how many cracks do we have that point in our (viewing) direction? G - Geometrical Attenuation Factor light gets obscured by other bumps F - Fresnel Term ( ) 61
Microfacet Models Microscopically rough surface Specular facets oriented randomly measure of scattering due to variation in angle of microfacets a statistic approximation, I.e. need a statistic distribution function 62
Rough Surface Diffuse Scattering Reduced Specular 63
Microfacet Distribution Blinn (Phong) Function D D( h ) = cos c h, where c = ln 2 ln cos D( h ) = e (c h) 2, where c = 2 Torrance-Sparrow (Gaussian) where m is the root mean square (standard deviation) slope of the facets (as an angle) beta is angle where distribution is one half of the total (0.5) 64
Microfacet Distribution Beckmann (most effective) D( h ) = Function D Represents a distribution of slopes But θ h = tanθ h for small θ h 1 m 2 cos 2 h e ( tan h m )2 65
Microfacet Distribution Function D 66
Multiscale Distribution Function May want to model multiple scales of roughness: Bumps on bumps j D( ω ) h = w j D ( j ω ) h w j =1 j 67
Self-Shadowing (V-Groove Model) Geometrical Attenuation Factor G how much are the cracks obstructing themselves? No interference G = min 1, 2 N ω h ω o ω h ( )( N ω ) o ( ) ( )( N ω ) i ( ), 2 N ω h ω o ω h 68
Cook-Torrance - Summary 69
Cook-Torrance: Examples Reflections on metal surfaces 70
Cook-Torrance - Summary 71
Ashikhmin Model Modern Phong Ad-hoc, but: Physically plausible Anisotropic Good for both Monte-Carlo and HW implementation 72
Ashikhmin Model Weighted sum of diffuse and specular part: f r (p,ω i,ω o ) = k d 1 k s Dependence of diffuse weight on k s decreases diffuse reflectance when specular reflectance is large Specular part f s not an impulse, really just glossy Diffuse part f d not constant: energy specularly reflected cannot be diffusely reflected For metals, f d = 0 ( ) f d (p,ω i,ω o ) + k s f s (p,ω i,ω o ) 73
Ashikhmin Model k s : Spectrum or colour of specular reflectance at normal incidence. k d : Spectrum or colour of diffuse reflectance (away from the specular peak). q u, q v : Exponents to control shape of specular peak. Similar effects to Blinn-Phong model If an isotropic model is desired, use single value q A larger value gives a sharper peak Anisotropic model requires two tangent vectors u and v The value qu controls sharpness in the direction of u The value qv controls sharpness in the direction of v 74
Ashikhmin Model φ is the angle between u and ω h D( ω ) = ( q +1) ( q +1) ( ω N) ( q u cos2 φ +q v sin 2 φ) h u v h 75
Ashikhmin Model Diffuse term given by: f d (p,ω i,ω o ) = 28 23π 1 1 ω o N ( ( ( )) 5 ) 1 1 ( ω i N) ( ( ) 5 ) Leading constant chosen to ensure energy conservation Form comes from Schlick approximation to Fresnel factor Diffuse reflection due to subsurface scattering: once in, once out 76
Complex BRDF Combination of the three. + + 77
BRDF Illustrations Phong Illumination Oren-Nayar 78
BRDF Illustrations Cook-Torrance-Sparrow BRDF Hapke BRDF 79
BRDF illustrations lumber cement 80
BRDF illustrations Surface microstructure 81
bv = Brdf Viewer Diffuse Torrance-Sparrow Anisotropic Szymon Rusinkiewicz, Princeton U. 82
Other Local Illumination Models HTSG He, Torrance, Sillion, Greenberg Physically most accurate model Wave-optics and diffraction Difficult to implement Difficult choice of parameters General anisotropic illumination Brushed metal Velvet General description of wave effects and diffraction CDs Thin-film effects (e.g. oil on water surface) 83
BRDF cannot Spatial variation of reflectance 84
BRDF cannot Transparency and Translucency (depth) Glass: transparent Wax: translucent BTDF Opaque milk (rendered) BSSRDF Translucent milk (rendered) 85