computer graphics - max planck societyresources.mpi-inf.mpg.de/departments/d4/teaching/... ·...
TRANSCRIPT
Computer Graphics WS07/08 – BRDFs and Texturing
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
• BRDF– Ratio of reflected radiance to incident irradiance
∫+Ω
= iiiioiroo ωdθxLxfxL cos ),( ),,(),( ωωωω
),(),(),,(
ii
ooior xdE
xdLxfωωωω =
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]
iiii
oo
ii
ooior
dxdLxdL
xdExdLxf
ωθωω
ωωωω
cos),(),(
),(),(),,(
=
=
Computer Graphics WS07/08 – BRDFs and Texturing
BRDF Properties• Helmholtz reciprocity principle
– BRDF remains unchanged if incident and reflected directions are interchanged
• Smooth surface: isotropic BRDF– reflectivity independent of rotation around surface normal– BRDF has only 3 instead of 4 directional degrees of freedom
),(),( oirior ff ωωωω =
),,,( iooir xf ϕϕθθ −
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
– Reflection only at the point of entry (xi = xo)• No subsurface scattering
ϕθωθωω , 1cos),,( ∀≤∫Ω
ooior dxf
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– Absorption– Surface micro-geometry– Index of refraction / dielectric constant– Scattering
Magnesium; λ=0.5μm
Aluminum; λ=0.5μm
Aluminum; λ=2.0μ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: surface normal– I: vector to the light source– V: viewpoint direction vector– H: halfway vector
H= (I + V) / |I + V|– R(I): reflection vector
R(I)= I - 2(I•N)N– Tangential surface: local plane
R(I)
R(V)
HV
IN
I
I
--((II••NN))NN
--((II••NN))NN
N
R(I)
IN R(I)
V
H
R(V)
Top view
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
θ θo
N RI
θ = θo ϕ = ϕo + 180°
ϕo
ϕI
R+(-I) = 2 cosθ N = -2(I• N) NR(I) = I - 2(I• N) N
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)
• Specular reflectance ρs– Ratio of reflected radiance in specular
direction and incoming radiance– Dimensionless quantity between 0 and 1
),()( cos),(),,(),(
)(cos
)cos(cos)(),,(
,
,
πϕθθρωθϕθωωω
πϕϕδθ
θθδθρωω
±==
±−⋅−
⋅=
∫+Ω
ooiisiiiiiiomroo
oii
oiisiomr
LdLxfxL
xf
L
N
R
θoθi( ) ( )( )ii
oois θΦ
θΦ=θρ
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
– kd: diffuse coefficient, material property [1/sr]
EkdxLkdxLkxL
kxf
diiiidiiiidoo
diodr
===
==
∫∫ΩΩ
ωθωωθωω
ωω
cos),( cos),(),(
const),,(,
NI Lo= const
Computer Graphics WS07/08 – BRDFs and Texturing
• Radiosity
• Diffuse Reflectance
• Lambert’s Cosine Law
• For each light source– Lr,d = kd Li cosθi = kd Li (I•N)
Lambertian Diffuse Reflection
dd kEB πρ ==
θi
NI
LLr,dr,d
oooooooo LdLdxLB cos cos),( πωθωθω === ∫∫ΩΩ
iidd EEB θρρ cos==
Computer Graphics WS07/08 – BRDFs and Texturing
Lambertian Objects
Ω⋅∝Φ dL00
Self-Luminous spherical Lambertian Light Source
dΩ
Ω⋅⋅∝Φ dL ϕcos01
Eye-light illuminated Spherical Lambertian Reflector
dΩ
ϕ
Computer Graphics WS07/08 – BRDFs and Texturing
Lambertian Objects II
⇒ Neither the Sun nor the Moon are Lambertian
• Absorption in photosphere• Path length through photospherelonger from the Sun’s rim
• Surface covered with fine dust• Dust on TV visible best from
slanted viewing angle
The Sun The Moon
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
– Lr,s = Li ks coske θRV
• Dot product & power• Not energy conserving/reciprocal• Plastic-like appearance
R(I)
R(V)
HV
INI
N R(I)
V
H
θθRVRV
θθHNHN
( ) eksior VIRkxf ⋅= )(),,( ωω
Computer Graphics WS07/08 – BRDFs and Texturing
Phong Exponent ke
• Determines size of highlight
( ) eksior VIRkxf ⋅= )(),,( ωω
Computer Graphics WS07/08 – BRDFs and Texturing
Blinn-Phong Reflection Model• Blinn-Phong reflection model
– Lr,s = Li ks coske θHN– θRV ⇒ θHN– Light source, viewer far away– I, R constant: H constant
θHN less expensive to compute
R(I)
R(V)
HV
INI
N R(I)
V
H
θθRVRV
θθHNHN
( ) eksior NHkxf ⋅=),,( ωω
Computer Graphics WS07/08 – BRDFs and Texturing
Phong Illumination Model• Extended light sources: l point light sources
• 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
(Blinn))()(L
Phong)())(()(L
,r
,r
∑ ∑
∑ ∑⋅+⋅+=
⋅+⋅+=
l
kl
llslldaia
l
kl
llslldaia
e
e
NHLkNILkLk
VIRLkNILkLk
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
σ 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
2
22
4)/),(tanexp(
))((1
πσσNH
NVNIρ
πρf s
dr
∠−•
••+=
N
IVviewer H θ
microfacetsurface
Computer Graphics WS07/08 – BRDFs and Texturing
Physics-inspired BRDFs • Notion of reflecting microfacet• Specular reflectivity of the form
– 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
VNFGDf i
r ⋅⋅⋅
=π
θλλ ),(
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:
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
1; ≤++= sdssddr kkkkf ρρ
Computer Graphics WS07/08 – BRDFs and Texturing
Cook-Torrance Specular Term
• 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– relates incident light to reflected light for each planar microfacet
• N·V : Proportional to visible surface area• N·I : Proportional to illuminated surface area
))(( INVNDGF
s ⋅⋅=π
ρ λ
N
IVviewer H θ
microfacetsurface
λλ ))(1( NVF ⋅+≈
Computer Graphics WS07/08 – BRDFs and Texturing
Microfacet Distribution Functions• Isotropic Distributions
α : angle to average normal of surface– Characterized by half-angle β
• Blinn
• Torrance-Sparrow
• Beckmann– m : average slope of the
microfacets– Used by Cook-Torrance
( ) [ ]2/tan42 cos4
1 mem
D α
αα −=
( )2
2⎟⎟⎠
⎞⎜⎜⎝
⎛−
=α
βα eD
( ) αα βcosln2ln
cos=D
( )21
=βD
( ) ( ) HN ⋅=⇒ ααω DD
N
IVviewer H θ
microfacetsurface
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
• Partial masking of reflected light
• Partial shadowing of incident light
⎭⎬⎫
⎩⎨⎧
⋅⋅⋅
⋅⋅⋅
=)(
))((2,)(
))((2,1minHV
INHNHV
VNHNG
1=G
)())((2
HVVNHNG
⋅⋅⋅
=
)())((2
HVINHNG
⋅⋅⋅
=
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• Specular reflection
Object properties constant over surface
• Multiple local light sources• Different BRDFs
Computer Graphics WS07/08 – BRDFs and Texturing
TexturingLocally 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 Space (2-D)
ObjectSpace (3-D)
ImageSpace (2-D)
Texture-SurfaceTransformation
Viewing/ProjectionTransformation
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
• How to interpolate the color of the pixel?
c3 c2
c0 c1
Computer Graphics WS07/08 – BRDFs and Texturing
Interpolation 1D
• How to interpolate the color of the pixel?
s1-s
c3 c2
c0 c1
Computer Graphics WS07/08 – BRDFs and Texturing
Interpolation 2D
• How to interpolate the color of the pixel?
s1-s
c3 c2
c0 c1
Computer Graphics WS07/08 – BRDFs and Texturing
Interpolation 2D
• 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
tt 1-ts1-s
c3 c2
c0 c1