Brdfs & Texturing
Total Page:16
File Type:pdf, Size:1020Kb
Computer Graphics - BRDFs & Texturing - Hendrik Lensch Computer Graphics WS07/08 – BRDFs and Texturing Overview • Last time – Radiance – Light sources – Rendering Equation & Formal Solutions • Today – Bidirectional Reflectance Distribution Function (BRDF) – Reflection models – Projection onto spherical basis functions – Shading • Next lecture – Varying (reflection) properties over object surface: texturing Computer Graphics WS07/08 – BRDFs and Texturing Reflection Equation - Reflectance • Reflection equation L (x,ω ) = f (ω , x,ω ) L (x,ω ) cosθ dω o o ∫ r i o i i i i Ω+ • BRDF – Ratio of reflected radiance to incident irradiance dLo (x,ωo ) fr (ωo , x,ωi ) = dEi (x,ωi ) Computer Graphics WS07/08 – BRDFs and Texturing Bidirectional Reflectance Distribution Function • BRDF describes surface reflection for light incident from direction (θi,φi) observed from direction (θο,φο) • Bidirectional – Depends on two directions and position (6-D function) • Distribution function – Can be infinite • Unit [1/sr] dLo (x,ω o ) fr (ω o , x,ω i ) = dEi (x,ω i ) dL (x,ω ) = o o dLi (x,ω i )cosθi dωi Computer Graphics WS07/08 – BRDFs and Texturing BRDF Properties • Helmholtz reciprocity principle – BRDF remains unchanged if incident and reflected directions are interchanged fr (ωo ,ωi ) = fr (ωi ,ωo ) • Smooth surface: isotropic BRDF – reflectivity independent of rotation around surface normal – BRDF has only 3 instead of 4 directional degrees of freedom fr (x,θi ,θo ,ϕo −ϕi ) Computer Graphics WS07/08 – BRDFs and Texturing BRDF Properties • Characteristics – BRDF units [sr--1] • Not intuitive – Range of values: • From 0 (absorption) to ∞ (reflection, δ -function) – Energy conservation law • No self-emission • Possible absorption f (ω , x,ω )cosθ dω ≤1 ∀ θ,ϕ ∫ r o i o o Ω – Reflection only at the point of entry (xi = xo) • No subsurface scattering Computer Graphics WS07/08 – BRDFs and Texturing BRDF Measurement • Gonio-Reflectometer • BRDF measurement – point light source position (θ,ϕ) – light detector position (θo ,ϕo) • 4 directional degrees of freedom • BRDF representation – m incident direction samples (θ,ϕ) – n outgoing direction samples (θo ,ϕo) – m*n reflectance values (large!!!) Stanford light gantry Computer Graphics WS07/08 – BRDFs and Texturing Reflectance • Reflectance may vary with – Illumination angle – Viewing angle – Wavelength – (Polarization, ...) • Variations due to Aluminum; λ=2.0μm – Absorption – Surface micro-geometry – Index of refraction / dielectric constant –Scattering Aluminum; λ=0.5μm Magnesium; λ=0.5μm Computer Graphics WS07/08 – BRDFs and Texturing BRDF Modeling • Phenomenological approach – Description of visual surface appearance • Ideal specular reflection – Reflection law – Mirror • Glossy reflection – Directional diffuse – Shiny surfaces • Ideal diffuse reflection – Lambert’s law – Matte surfaces Computer Graphics WS07/08 – BRDFs and Texturing Reflection Geometry • Direction vectors (normalize): N –N: surface normal -(I•N)N –I: vector to the light source R(I) –V: viewpoint direction vector I –H: halfway vector -(I•N)N H= (I + V) / |I + V| –R(I): reflection vector R(I)= I -2(I•N)N I – Tangential surface: local plane Top view R(V) H N R(I) N I R(I) I R(V) V V H Computer Graphics WS07/08 – BRDFs and Texturing Ideal Specular Reflection • Angle of reflectance equal to angle of incidence • Reflected vector in a plane with incident ray and surface normal vector R+(-I) = 2 cosθ N = -2(I• N) N R(I) = I -2(I• N) N I N R ϕ I o θ ϕ θo θ = θo ϕ = ϕo + 180° Computer Graphics WS07/08 – BRDFs and Texturing Mirror BRDF • Dirac Delta function δ(x) – δ(x) : zero everywhere except at x=0 – Unit integral iff integration domain contains zero (zero otherwise) δ (cosθi − cosθo ) fr,m (ωo , x,ωi ) = ρs (θi )⋅ ⋅δ (ϕi −ϕo ±π ) cosθi L (x,ω ) = f (ω , x,ω )L (θ ,ϕ )cosθ dω = ρ (θ )L (θ ,ϕ ±π ) o o ∫ r,m o i i i i i i s i i o o Ω+ • Specular reflectance ρs – Ratio of reflected radiance in specular N direction and incoming radiance L R – Dimensionless quantity between 0 and 1 Φo (θo ) θi θo ρs ()θi = Φi ()θi Computer Graphics WS07/08 – BRDFs and Texturing Diffuse Reflection • Light equally likely to be reflected in any output direction (independent of input direction) • Constant BRDF fr,d (ω o , x,ω i ) = kd = const L (x,ω ) = k L (x,ω )cosθ dω = k L (x,ω )cosθ dω = k E o o ∫ d i i i i d ∫ i i i i d Ω Ω –kd: diffuse coefficient, material property [1/sr] I N Lo= const Computer Graphics WS07/08 – BRDFs and Texturing Lambertian Diffuse Reflection B = L (x,ω )cosθ dω = L cosθ dω = π L • Radiosity ∫ o o o o o ∫ o o o Ω Ω B • Diffuse Reflectance ρ = = π k d E d • Lambert’s Cosine Law B = ρd E = ρd Ei cosθi • For each light source I –Lr,d = kd Li cosθi = kd Li (I•N) N Lr,d θi Computer Graphics WS07/08 – BRDFs and Texturing Lambertian Objects Self-Luminous Eye-light illuminated spherical Lambertian Light Source Spherical Lambertian Reflector Φ0 ∝ L0 ⋅dΩ Φ1 ∝ L0 ⋅cosϕ ⋅dΩ ϕ dΩ dΩ Computer Graphics WS07/08 – BRDFs and Texturing Lambertian Objects II The Sun The Moon • Absorption in photosphere • Surface covered with fine dust • Path length through photosphere • Dust on TV visible best from longer from the Sun’s rim slanted viewing angle ⇒ Neither the Sun nor the Moon are Lambertian Computer Graphics WS07/08 – BRDFs and Texturing “Diffuse” Reflection • Theoretical explanation – Multiple scattering • Experimental realization – Pressed magnesium oxide powder – Almost never valid at high angles of incidence Paint manufacturers attempt to create ideal diffuse paints Computer Graphics WS07/08 – BRDFs and Texturing Glossy Reflection Computer Graphics WS07/08 – BRDFs and Texturing Glossy Reflection • Due to surface roughness • Empirical models – Phong – Blinn-Phong • Physical models –Blinn – Cook & Torrance Computer Graphics WS07/08 – BRDFs and Texturing Phong Reflection Model • Cosine power lobe ke fr (ωo , x,ωi ) = ks (R(I)⋅V ) ke –Lr,s = Li ks cos θRV • Dot product & power • Not energy conserving/reciprocal • Plastic-like appearance R(V) θ H N HN R(I) N I θRV I R(I) V V H Computer Graphics WS07/08 – BRDFs and Texturing Phong Exponent ke ke fr (ωo , x,ωi ) = ks (R(I)⋅V ) • Determines size of highlight Computer Graphics WS07/08 – BRDFs and Texturing Blinn-Phong Reflection Model • Blinn-Phong reflection model ke fr (ωo , x,ωi ) = ks (H ⋅ N ) ke –Lr,s = Li ks cos θHN – θRV ⇒θHN – Light source, viewer far away –I, R constant: H constant θHN less expensive to compute R(V) θ H N HN R(I) N I θRV I R(I) V V H Computer Graphics WS07/08 – BRDFs and Texturing Phong Illumination Model • Extended light sources: l point light sources ke Lr = ka Li,a + kd ∑ Ll (Il ⋅ N) + ks ∑ Ll (R(Il )⋅V ) (Phong) l l ke Lr = ka Li,a + kd ∑∑Ll (Il ⋅ N) + ks Ll (Hl ⋅ N) (Blinn) l l • Color of specular reflection equal to light source • Heuristic model – Contradicts physics – Purely local illumination • Only direct light from the light sources • No further reflection on other surfaces • Constant ambient term • Often: light sources & viewer assumed to be far away Computer Graphics WS07/08 – BRDFs and Texturing Microfacet Model • Isotropic microfacet collection • Microfacets assumed as perfectly smooth reflectors • BRDF – Distribution of microfacets • Often probabilistic distribution of orientation or V-groove assumption – Planar reflection properties – Self-masking, shadowing Computer Graphics WS07/08 – BRDFs and Texturing Ward Reflection Model • BRDF ρ 1 exp(− tan 2 ∠(H, N) /σ 2 ) f = d + ρ • r π s (I • N)(V • N) 4πσ 2 σstandard deviation (RMS) of surface slope – Simple expansion to anisotropic model (σx, σy) – Empirical, not physics-based – Inspired by notion of reflecting microfacets – Convincing results – Good match to measured data N viewer H V θ I surface microfacet Computer Graphics WS07/08 – BRDFs and Texturing Physics-inspired BRDFs • Notion of reflecting microfacet • Specular reflectivity of the form D ⋅G ⋅ F (λ,θ ) f = λ i r π N ⋅V – D : statistical microfacet distribution – G : geometric attenuation, self-shadowing – F : Fresnel term, wavelength, angle dependency of reflection along mirror direction –N•V : flaring effect at low angle of incidence • Cook-Torrance model – F : wavelength- and angle-dependent reflection – Metal surfaces Computer Graphics WS07/08 – BRDFs and Texturing Cook-Torrance Reflection Model • Cook-Torrance reflectance model is based on the microfacet model. The BRDF is defined as the sum of a diffuse and specular components: fr = kd ρd + ks ρs ; kd + ks ≤1 where ks and kd are the specular and diffuse coefficients. • Derivation of the specular component ρs is based on a physically derived theoretical reflectance model Computer Graphics WS07/08 – BRDFs and Texturing Cook-Torrance Specular Term N F DG ρ = λ viewer V H θ s π (N ⋅V )(N ⋅ I) I surface microfacet • D : Distribution function of microfacet orientations • G : Geometrical attenuation factor – represents self-masking and shadowing effects of microfacets • Fλ : Fresnel term λ – computed by Fresnel equation Fλ ≈ (1+ (V ⋅ N)) – relates incident light to reflected light for each planar microfacet • N·V : Proportional to visible surface area • N·I : Proportional to illuminated surface area Computer Graphics WS07/08 – BRDFs and Texturing Microfacet Distribution Functions • Isotropic Distributions D(ω)⇒ D(α ) α = N ⋅H α : angle to average normal of surface N – Characterized by half-angle β H θ viewer V I 1 D()β = surface 2 microfacet ln 2 • Blinn D()α = cos lncos β α 2 ⎛ 2 ⎞ −⎜ α ⎟ • Torrance-Sparrow ⎜ β ⎟ D()α = e ⎝ ⎠ • Beckmann 2 1 −[]tanα / m – m : average slope of the D()α = 2 4 e microfacets 4m cos α – Used by Cook-Torrance Computer Graphics WS07/08 – BRDFs and Texturing Beckman Microfacet Distribution Function m=0.2 m=0.6 Computer Graphics WS07/08 – BRDFs and Texturing Geometric Attenuation Factor • V-shaped grooves • Fully illuminated and visible G =1 • Partial masking of reflected light 2(N ⋅ H )(N ⋅V ) G = (V ⋅ H ) • Partial shadowing of incident light 2(N ⋅ H )(N ⋅ I) G = (V ⋅ H ) ⎧ 2(N ⋅ H )(N ⋅V ) 2(N ⋅ H )(N ⋅ I)⎫ G = min⎨1, , ⎬ ⎩ (V ⋅ H ) (V ⋅ H ) ⎭ Computer Graphics WS07/08 – BRDFs and Texturing Comparison Phong vs.