Lighting vs. Shading Shading Commonly misused terms. Computing - - PDF document

lighting vs shading shading
SMART_READER_LITE
LIVE PREVIEW

Lighting vs. Shading Shading Commonly misused terms. Computing - - PDF document

Computer Graphics as Virtual Photography real camera photo Photographic Photography: scene (captures processing print Material Properties light) processing Illumination Models / BRDFs camera Computer 3D synthetic tone model


slide-1
SLIDE 1

1 Material Properties

Illumination Models / BRDFs

Computer Graphics as Virtual Photography

camera (captures light) synthetic image camera model (focuses simulated lighting)

processing

photo processing tone reproduction real scene 3D models Photography: Computer Graphics: Photographic print

Shading

  • Computing the light that leaves a point
  • Shading point - point under investigation
  • Illumination model - function or algorithm used to

describe the reflective characteristics of a given surface.

  • Shading model – algorithm for using an illumination

model to determine the color of a point on a surface.

  • For efficiency’s sake, most illumination models are

approximations.

Lighting vs. Shading

  • Commonly misused terms.
  • What’s the difference?
  • Lighting / Illumination designates the interaction

between materials and light sources.

  • Shading is the process of determining the color of

a pixel.

– Usually determined by lighting. – Could use other methods: random color, NPR, etc.

Reflections

  • Ambient – light uniformly incident from the

environment

  • Diffuse – light scattered equally in all directions
  • Ambient and Diffuse – color of material plays a

part

  • Specular – highlights connected with mirrorness
  • Specular – mostly color of light

Bi-directional Reflectance Functions (BRDF)

slide-2
SLIDE 2

2

BRDF

  • Bi-directional Reflectance Function

) , , , (

r r i i r

f BRDF θ φ θ φ =

At a given point, gives relative reflected illumination in any direction with respect to incoming illumination coming from any direction; Note: The θ’s are elevation, ϕ’s are measured about the surface normal. The i’s refer to the incident ray; the r’s to the reflected ray.

BRDF Geometry BRDF

  • Can return any positive value.
  • Generally wavelength specific.

) , , , , ( λ θ φ θ φ

r r i i r

f BRDF =

BRDF

  • Simplifying Assumptions wrt the BRDF

– Light enters and leaves from the same point.

  • Not necessarily true
  • Subsurface scattering
  • Skin, marble

– Light of a given wavelength will only reflect back light of that same wavelength

  • Not necessarily true
  • Light Interference
  • Oily patches, peacock feathers

Illumination Models

  • Illumination model - function or algorithm

used to describe the reflective characteristics of a given surface.

  • Revise to…

– function or algorithm used in approximating the BRDF.

Illumination Modeling

  • Four approaches

– Simplistic

  • Based on physics, abiet with many assumptions

– Heuristic

  • The kludge!
  • Usually simple, yet not physically based

– Simulation

  • Employ physical model
  • More complex than heuristic, but more accurate

– Empirical

  • Use measured samples
slide-3
SLIDE 3

3

Illumination Models

  • Illumination Models and Viewing Direction

– Generally, BRDFs are independent of viewing direction – Most Illumination models take viewing direction into consideration

Illumination Models

  • Geometry

N H S V R

reflection viewer normal Half-way source

Illumination Models

  • Geometry

– N - normal vector – S - direction of incoming light – R - direction of perfect mirror reflection – H - halfway between light direction and viewing direction. – V - viewing direction.

Illumination Models

  • Recall from Linear Algebra

θ u v

θ cos v u v u =

  • Just one reason to normalize!

Illumination Modeling

  • Four approaches

– Simplistic

  • Lamertian

– Heuristic

  • Phong

– Simulation

  • Cook-Torrance

– Empirical

  • Use measured samples

Illumination Models

  • BRDF Viewer

– bv by Szymon Rusinkiewicz (Princeton) – http://graphics.stanford.edu/~smr/brdf/bv – SGI, Linux, and Java versions although not readily available for Java. I have it, if you want it, and you’ll need to load Java3D as well!

slide-4
SLIDE 4

4

Simplistic

  • Lambertian Model

– Perfectly diffuse surface – reflection is constant in all directions (kd) – Independent of viewer direction – Based on Lambert’s cos law. – Sometimes mistakenly attributed to Gouraud.

  • Gouraud didn’t introduce a new lighting model, just a shading

method.

Lambert’s Cosine Law

  • The reflected luminous intensity in

any direction from a perfectly diffusing surface varies as the cosine

  • f the angle between the direction of

incident light and the normal vector of the surface.

  • Intuitively

– cross-sectional area of the “beam” intersecting an element

  • f surface area is smaller for greater

angles with the normal.

Lambertian Model

  • Lambert Model

θ cos ) (

d Sk

L V L = ) ( ) ( S N k L V L

d S

  • =

Lambertian Model

  • BRDF Viewer

http://graphics.stanford.edu/~smr/brdf/bv

Those Were the Days

  • (Or: how not to motivate a 21st century

computer graphics paper.)

  • “In trying to improve the quality of the synthetic

images, we do not expect to be able to display the

  • bject exactly as it would appear in reality, with

texture, overcast shadows, etc. We hope only to display an image that approximates the real object closely enough to provide a certain degree of realism.” – Bui Tuong Phong, 1975

Phong Model

  • Phong Model

– introduces specular (mirror-like) reflections – Viewer direction becomes more important – three components

  • ambient - background light (ka)
  • diffuse - Lambertian reflection (kd)
  • specular – mirror-like reflection(ks)
slide-5
SLIDE 5

5

Phong Model

specular diffuse ambient

V) R ( N) S ( ) (

∑ ∑

  • +
  • +

=

i k i i s i i i d a a

e

L k L k L k V L

Note: Ln are radiance terms, include both light and material info

Phong-Blinn Model

– Uses halfway angle rather than reflected

specular diffuse ambient

N) H ( N) S ( ) (

∑ ∑

  • +
  • +

=

i k i i s i i i d a a

e

L k L k L k V L

Phong-Blinn Model

  • BRDF Viewer

http://graphics.stanford.edu/~smr/brdf/bv

Physically based

– based on physics of a surface

  • Actually developed by Torrance & Sparrow, physicists.
  • Jim Blinn was the first to apply to CG
  • Cook & Torrance’s was the first complete implementation

– components

  • microfacet model - describes geometry of surface

– And how much the microfacets shadow each other.

  • Fresnel term - describes reflectance
  • Roughness - describes microfacet distribution.

Cook-Torrance Model

  • Microfacets

– surface is composed of V shaped grooves (microfacets) – Light interactions with microfacets

  • Reflect - causes specular reflections
  • Scatter - causes diffuse reflections

Cook-Torrance Model

  • Microfacets
slide-6
SLIDE 6

6

Cook-Torrance Model

  • Microfacets – GeometryTerm

– Some microfacets may shadow others

⎭ ⎬ ⎫ ⎩ ⎨ ⎧

  • =

H) (V S) H)(N N ( 2 , H) (V V) H)(N N ( 2 , 1 min G

Note: S from before is the L in these diagrams

Cook-Torrance Model

  • Fresnel Equation for polarized light

– Describes reflectance as a function of:

  • Wavelength of incident light (λ)
  • Index of refraction (η(λ))
  • Extinction coefficient (ease at which wave can

penetrate a surface) (κ(λ))

  • Angle of incidence (θ)

Cook-Torrance Model

  • Fresnel equations for polarized light

θ θ θ θ

2 2 2 2 2 2

cos cos 2 cos cos 2 + + + + − + = a b a a b a Fs θ θ θ θ θ θ θ θ

2 2 2 2 2 2 2 2

tan sin tan sin 2 tan sin tan sin 2 + + + + − + = a b a a b a F F

s p

a, b are functions

  • f η, κ, and θ

η, κ are functions

  • f λ

p s

F F F 2 1 2 1 + =

F is total reflectance

Perpendicular component Parallel component

Cook-Torrance Model

  • Fresnel

– If all quantities known, use Fresnel equations – If not, approximate using reflectance off normal

  • See [Glassner] or [Cook/Torrance81] for details

Cook-Torrance Model

  • Roughness

– Characterizes the distribution of the slopes of the microfacets – Roughness parameter, m

  • m between 0 -1
  • small m - smooth surface, specular reflectance
  • large m - rough surface, diffuse reflectance

– Statistical models

Cook-Torrance Model

  • Roughness

2

) / ( m

ce D

α −

=

α

α

4 2 ) / ) ((tan

cos

2

m e D

m −

=

Gaussian Model c is arbitrary constant Beekman Model

slide-7
SLIDE 7

7

Cook-Torrance Model

  • Roughness

Cook-Torrance Model

  • Putting it all together

π 1 =

d

f

V) S)(N N ( 1

  • ×

× = G D F fs π

diffuse specular d s r

df sf f + =

total reflectance

Where D is the roughness function, F is the Fresnel function, and G is the geometrical attenuation factor from previous pages

Cook-Torrance Model

  • Complete Cook-Torrance Model

  • +

=

i i r i a a r

d f L R L L ϖ ) Si)( N (

  • Parameters for fr:

m – roughness value Type of material (determines terms for Fresnel eqn) Wavelength of incident light (determines terms for Fresnel eqn) Diffuse / specular contribution constants La Ra is the ambient radiance reflected by Ra Li is the light’s radiance

Cook-Torrance Models

  • examples

Cook-Torrance Models

  • BRDF Viewer

http://graphics.stanford.edu/~smr/brdf/bv

Cook-Torrance Model

  • Summary

– Complicated model based on physics – Components

  • Microfacets
  • Fresnel equation
  • Roughness

– Want accuracy? Go to the source!

slide-8
SLIDE 8

8

Illumination Models

  • There are many other illumination models - both

empirical approximations and rigorous physically based solutions.

  • Looking ahead

– All these models are predefined with fixed parameters – For extensibility in defining BDRFs, use a procedural system (I.e. shaders)

Empirical

  • Can use empirical data
  • BRDFs measured using a goniometer
  • See [Ward92]

Measuring BRDFs

Light Receptor

Measuring BRDFs

  • Storage using spherical sampling

Measuring BRDFs

  • BRDF Databases

– Cornell

  • http://www.graphics.cornell.edu/online/measurements

– Columbia-Utrecht

  • http://www.cs.columbia.edu/CAVE/curet

Measuring BRDFs

  • Problems with measured BRDFs

– Large – Difficult to control measuring device – Can be noisy, due to measurement device – Non-extensible

  • Specific to a given material
slide-9
SLIDE 9

9

Summary

  • BRDFs - defines reflection off surface in

each direction as result from light arriving at each direction.

  • Illumination models - approximations to

BRDF

  • Can use measured BRDFs

Summary

  • BRDF
  • Approaches

– Simplistic

  • Lambertian

– Hueristic

  • Phong

– Physically-based

  • Cook-Torrance

– Empirical

Further Reading

  • Glassner, Principles of Digital Image

Synthesis, Chapter 15.

  • See paper list (on Web) for papers on

individual models

– [Cook81] – [Ward92] [Kajiya85] [Poulin90][He91] – [Strauss90]