- 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 – • 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]

ω dL (ωx,ω ) f ( , x,ω ) = o o r o i dE (x, ) i 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 domaiϕ n 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 microfacet α 2 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. Torrance

Computer Graphics WS07/08 – BRDFs and Texturing Texturing

Computer Graphics WS07/08 – BRDFs and Texturing Simple Illumination

• No illumination • Constant colors

• Parallel light • Diffuse reflection

Computer Graphics WS07/08 – BRDFs and Texturing Standard Illumination

• Parallel light • Multiple local light sources • Specular reflection • Different BRDFs

Object properties constant over surface

Computer Graphics WS07/08 – BRDFs and Texturing Texturing Locally varying object characteristics • 2D Image Textures • Shadows • Bump-Mapping • Reflection textures

Computer Graphics WS07/08 – BRDFs and Texturing Texture-modulated Quantities • Modulation of object surface properties • Reflectance – Color (RGB), diffuse reflection coefficient kd – Specular reflection coefficient ks • Opacity (α) • Normal vector – N(P)= N(P+ t N) or N= N+dN – „Bump mapping“ or „Normal mapping“ • Geometry –P= P + dP – „Displacement mapping“ • Distant illumination – “Environment mapping“, “Reflection mapping“

Computer Graphics WS07/08 – BRDFs and Texturing Texture Mapping Transformations

Texture Object Image Space (2-D) Space (3-D) Space (2-D)

Texture-Surface Viewing/Projection Transformation Transformation

The texture is mapped onto a surface in 3-D object space, which is then mapped to the screen by the viewing projection. These two mappings are composed to find the overall 2-D texture space to 2-D image space mapping, and the intermediate 3-D space is often forgotten. This simplification suggests texture mapping’s close ties with image warping and geometric distortion.

Texture space (u,v) Object space (xo,yo,zo) Screen space (x,y)

Computer Graphics WS07/08 – BRDFs and Texturing 2D Texturing

• 2D texture mapped onto object • Object projected onto 2D screen • 2D→2D: warping operation • Uniform sampling ? • Hole-filling/blending ?

Computer Graphics WS07/08 – BRDFs and Texturing Texture Mapping in a Ray Tracer

• approximation: – ray hits surface – surface location corresponds to coordinate inside a texture

Computer Graphics WS07/08 – BRDFs and Texturing Texture Mapping in a Ray Tracer

• approximation: – ray hits surface – surface location corresponds to coordinate inside a texture

Computer Graphics WS07/08 – BRDFs and Texturing Interpolation 1D

c3 c2

c0 c1

• How to interpolate the color of the pixel?

Computer Graphics WS07/08 – BRDFs and Texturing Interpolation 1D

c3 c2 1-s s c0 c1

• How to interpolate the color of the pixel?

Computer Graphics WS07/08 – BRDFs and Texturing Interpolation 2D

c3 c2 1-s s c0 c1

• How to interpolate the color of the pixel?

Computer Graphics WS07/08 – BRDFs and Texturing Interpolation 2D

c3 c2 1-s s c0 c1 t 1-t

• How to interpolate the color of the pixel? • 1D: i0 = (1-t)c0 + tc1 i1 = (1-t)c3 + tc2 • 2D: c = (1-s) i0 + s i1

Computer Graphics WS07/08 – BRDFs and Texturing