CSL 859: Advanced Computer Graphics - PowerPoint PPT Presentation

About This Presentation
Title:

CSL 859: Advanced Computer Graphics

Description:

Energy per unit wavelength? Spectral Energy: (Q in an interval ?)/? dQ/d?. Irradiance, H ... Torrance & Sparrow (1967) Blinn (1977) ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 54
Provided by: sub8
Category:

less

Transcript and Presenter's Notes

Title: CSL 859: Advanced Computer Graphics


1
CSL 859 Advanced Computer Graphics
  • Dept of Computer Sc. Engg.
  • IIT Delhi

2
Lighting in OpenGL
  • Per-vertex
  • per-pixel with Cg
  • Light and Material Properties
  • glLightfv RGBA
  • Color of light RGBA in 0255
  • glMaterialfv RGBA
  • Color of material RGBA in 0255
  • glColor3f RGBA
  • Uses glColorMaterial

3
Spectrum
4
Color Perception
  • Energy?
  • Q h/?
  • Some colors are perceived brighter

5
Definitions
  • Energy per unit wavelength?
  • Spectral Energy (Q in an interval ??)/?? ? dQ/d?
  • Irradiance, H
  • Spectral Power reaching surface per unit area
  • Radiance
  • ?H/?s, per unit solid angle

6
Surface Radiance
l
?
n
Surface Radiance L
7
Radiance Non-Attenuation
Both detectors see the same Radiance
8
Surface Radiance
l
dA
?
?
n
dA cos?
Surface Radiance L
9
BRDF
  • Bi-directional Reflectance Function
  • ?io Lo / Hlight

-i
o
10
Types of BRDFs
  • Isotropic
  • Reflectance independent of rotation about a given
    surface normal
  • Smooth plastics
  • Anisotropic
  • Reflectance changes with rotation around a given
    surface normal
  • Brushed metal, satin, hair

11
Luminous Efficiency
  • Lumens per watt (lm/W)
  • Photopic efficiency lt 683 lm/W
  • _at_ Monochromatic light with ? 555 nm (green).
  • Scotopic efficiency lt 1700 lm/W
  • _at_ ? 507 nm

12
Tri-Stimulus Theory
  • Metamers appear the same
  • Eyes have sensors
  • Rods (low resolution, Peripheral, Many)
  • Cones (High res, in fovea, few, 3 types)
  • Maximum response at 420 nm (blue),
  • Maximum response at 534 nm (Bluish-Green),
  • Maximum response at 564 nm (Yellowish-Green).
  • Integrating (Filtering) Sensors

13
CIE Color Standard
  • Three components
  • X Y Z
  • Y has luminance (perceived brightness)
  • X and Z have brightness
  • C X Y Z
  • Represented as
  • x X/(XYZ), y Y/(XYZ), Y
  • x and y have chromaticity, Y has luminance

14
CIE Chromaticity Diagram
15
Color Spaces
  • HSV
  • RGB
  • CMYK
  • HDR
  • Tone Mapping

16
Hue, Saturation, Value
17
Color in Hardware
  • RED is not the same on every monitor
  • Not even the same everytime on the same HW
  • User knobs, Ambient lighting
  • 01, in a normalized space
  • No limit in reality
  • 1 gt Maximum screen brightness
  • 0 gt Minimum screen brightness
  • Why R, G, B?
  • Engineering convenience
  • Gamma correction
  • Gamma can be commonly set by the user

18
Hardware Color Mapping
  • Normalize each component to 01
  • Fixed number of steps
  • Monitor dependent
  • Typically 255
  • Values 0..255 -gt v -gt intensity
  • Displayed I a (Maximum I) vy

19
Geometry of Local Lighting
  • Vertex normals make it smooth
  • Lights in Camera space
  • Already specified so in OpenGL

L
n
l
v
20
Diffuse Reflection
  • Reflection uniformly in all directions
  • Matte (Non-shiny) appearance
  • Eg, chalk
  • Most materials are not ideally diffuse

21
Specular Reflection
  • Light reflects in a single direction
  • Shiny
  • Eg, silvered mirror
  • Most materials are not ideally specular

22
Diffuse/Specular Reflection
  • Most materials are a combination of diffuse and
    specular
  • Reflection distribution function
  • Need not be in a plane
  • Need not be isotropic

23
Diffuse Reflection
  • Lamberts law
  • Amount of incident light per unit area is
    proportional to the cosine of the angle between
    the normal and the light rays

l3
l2
n
l1
surface
24
Diffuse Reflection
  • Unit vector l points to the light source

cl
n
l
fdiff
25
Directional Light
  • Distant light source
  • A unit length direction vector d and a color c
  • l -d
  • Color shining on the surface cl c

26
Point Lights
  • Radiates light equally in all directions
  • Intensity from a point light source drops off
    proportionally to the inverse square of the
    distance from the light

p
cpnt
l
n
cl
v
fdiff
27
Attenuation
  • Sometimes, inverse square falloff behavior is
    hacked approximated
  • A common damping of distance attenuation is

28
Multiple Lights
  • Additive
  • Interference does happen
  • E.g., soap bubbles

29
Ambient Light
  • Poor mans global illumination
  • Same amount everywhere
  • Often, famb is set to equal fdif

30
Blinns Model
  • Smooth gt well defined small highlights,
  • Rough gt Blurred, larger
  • Surface roughness modeled by microfacets
  • Distribution of microfacet normals
  • Polished
  • Smooth
  • Rough
  • Rougher

31
Specular Highlights
  • To compute the highlight intensity, we start by
    finding the unit length halfway vector h, which
    is halfway between the vector l pointing to the
    light and the vector e pointing to the eye
    (camera)

n
h
cl
e
l
fspec
32
Specular Highlights
  • The halfway vector h represents the direction
    that a mirror-like microfacet would have to be
    aligned in order to cause the maximum highlight
    intensity

n
h
cl
e
l
fspec
33
Specular Highlights
  • The microfacet normals generally point in the
    direction of the macro surface normal
  • The further h is from n, fewer facets are likely
    to align with h
  • The Blinn lighting model
  • s is shininess or specular exponent

34
Specular Highlights
  • Higher exponent more narrow the highlight

35
Shininess
n 1
n 5
n 10
n 50
36
Specular Highlights
  • To account for highlights, we simply add an
    additional contribution to our total lighting
    equation
  • Blinn lighting model.

37
Classic Lighting Models
  • Lambert
  • Blinn
  • Phong
  • Considers angle between normal and viewer
  • Cook-Torrance

n
n
h
cl
cl
e
e
l
l
fspec
fspec
Phong
Blinn
38
Cook Torrance
  • Contributors
  • Torrance Sparrow (1967)
  • Blinn (1977)
  • Models of Light Reflection for Computer
    Synthesized Pictures, SIGGRAPH77
  • Cook Torrance (1982)
  • A Reflectance Model for Computer Graphics, ACM
    TOG 1(1)
  • Thermodynamics and geometric optics
  • Explains off-cpecular peaks
  • No electromagnetics
  • Fails for very smooth surfaces

39
Cook Torrance
  • Ei Ii (N.L) d?i
  • R Ir/Ei
  • Ir R Ii (N.L) d?i
  • R sRs dRd, s d 1.
  • IrA RA IiA f
  • f 1/? ? (N.L) d?i
  • Shortcut, f 1

40
Intensity of Reflected Light
  • IR IiARA ?l (Iil (NLl) ??il(sRs dRD))

l Individual lights Iil Average intensity of
the incident light N Surface unit normal Ll
Unit vector in the direction of light l ??il
solid angle of a beam of incident light
41
Cook-Torrance Model
  • Rs F D G___
  • ? (NL) (NV)

F Fresnel term D Facet slope distribution
Fraction of facets oriented along H
(Roughness) G Geometrical attenuation factor
(occlusion) V Unit vector in the direction of
the viewer
42
Roughness
  • Blinn
  • D ce-(?/m)2
  • ? angle between H and N
  • (H angular bisector of V and L)
  • m root mean square (rms) slope of the facets
  • Beckmann
  • D 1/(m2cos4?) e-(tan2?/m2)

43
Beckmann vs Blinn
m 0.2
m 0.6
44
Geometric Attenuation
  • 0 lt G lt 1
  • No occlusion to full occlusion

45
Geometric Attenuation
46
Fresnel Factor
  • Wavelength dependent.
  • Refractive Index
  • Mirror-like at grazing angles

47
Some Examples
Material s d m
Carbon .3 .7 .4
Rubber .4 .6 .3
Obsidian .8 .2 .15
Lunar Dust 0 1 X
Olive drab .3 .7 .5
Rust .2 .8 .35
48
Some Examples
  • Metal refractive index absorption coeff.
  • Silver 0.177 3.638
  • Copper 0.617 2.63
  • Steel 2.485 3.433

49
Results of Cook-Torrance
Copper vase
  • Copper colored plastic

50
Compared to Phong
30o Incidence
70o Incidence
Torrance et al.
Phong
51
Shading
  • Gouraud
  • Light vertices
  • Interpolate colors
  • glShadeModel(GL_SMOOTH)
  • Phong
  • Per-pixel (Phong) lighting
  • Interpolate normals
  • Need pixel-programs

52
Advanced Lighting
  • Shadows
  • Accurate reflection models
  • Procedural shaders
  • Global Illumination
  • Volumetric effects (fog, translucency)
  • Lens imperfections
  • Exposure ( dynamic range)

53
Shadow Map
Scene
54
Shadow Map
  • Find x,y in the light space
  • Unproject camera, then Project light
  • But x and y may not be integers
  • Find nearest integers?
  • Read Depth buffer
  • Compare projected z with stored z.
Write a Comment
User Comments (0)
About PowerShow.com