Illumination - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Illumination

Description:

... we use a lot of approximations hacks, really to do this simulation fast ... be too great near the light source and too small far away time for a hack. ... – PowerPoint PPT presentation

Number of Views:369
Avg rating:3.0/5.0
Slides: 34
Provided by: mohdshahr
Category:

less

Transcript and Presenter's Notes

Title: Illumination


1
Illumination Lighting
2
Pipeline so far
  • Weve talked about the rendering pipeline
  • Transformations
  • Modeling
  • Viewing
  • Projection
  • Clipping
  • Rasterization w/ Depth
  • Given triangles in 3D, we can efficiently
    calculate which pixels they cover in the final
    image
  • But our model for surface color is rather simple
    and doesnt account for illumination.

3
Modeling surface-light interaction
  • If were attempting to create a realistic image,
    we need to simulate the lighting of the surfaces
    in the scene
  • Simulation of physics and optics
  • Two kinds of models for any simulation
  • Physically-based using real physical properties
    in model calculations
  • Empirical using approximations based on
    observation
  • As youll see, we use a lot of approximations
    hacks, really to do this simulation fast
    enough for interactive graphics.
  • A lot of current research is focused on how to
    make fast, accurate, physically-based models for
    interactive graphics.

4
Terms
  • Illumination the transport of energy (in
    particular, the luminous flux of visible light)
    from light sources to surfaces points
  • Note includes direct and indirect illumination
  • Lighting the process of computing the luminous
    intensity (i.e., outgoing light) at a particular
    3-D point, usually on a surface
  • Shading the process of assigning colors to pixels

5
Components of illumination
  • Two interacting components of illumination
  • light sources surface properties
  • Direct illumination is the interaction between a
    light source and the surfaces visible from the
    light source the first reflection of the light
    by a surface
  • Indirect illumination is the interaction between
    light reflected by one surface and other surfaces
    secondary (and more) reflections of the light

6
Surface properties
  • Spectrum of reflectance (surface color)
  • Geometric properties
  • Position
  • Orientation
  • Shape
  • Microgeometry (smooth, rough, in-between)

7
Light properties
  • Spectrum of emittance (light color)
  • Geometric properties
  • Position
  • Orientation
  • Shape
  • Directional attenuation

8
Ambient light
  • Indirect lighting computations require many many
    many many reflection calculations that too many
    manys to do interactively.
  • How can we simulate indirect illumination without
    all those reflection calculations?
  • Fake it. Assume a constant indirect luminance
    reaches all objects. We call this ambient light.
  • The objects then have a property that determines
    how much incident ambient light reflects off the
    surface.

9
Ambient lighting
  • For each sampled wavelength, the ambient light
    reflected from a surface depends on
  • Surface ambient reflection property
  • Ambient light source intensity a constant
    everywhere

10
Contoh ambient light
11
Diffuse reflection
  • An ideal diffuse reflector, at the microscopic
    level, is a very rough surface (chalk is a good
    approximation)
  • Because of these microscopic variations, an
    incoming ray of light is equally likely to be
    reflected in any direction

12
Lamberts cosine law
  • Ideal diffuse surfaces reflect according to
    Lamberts cosine law
  • The energy reflected by a small portion of a
    surface from a light source in a given direction
    is proportional to the cosine of the angle
    between that direction and the surface normal
  • These are often called Lambertian surfaces.
  • Note that the reflected intensity is dependent on
    the surface orientation with regard to the light
    source and that view direction has not bearing on
    the result for this reason we often refer to
    diffuse reflection as view-independent.

13
Diffuse lighting
  • The angle between the surface normal and the
    incoming light is the angle of incidence
  • In practice we use (unit) vector arithmetic

N
L
?
14
Diffuse lighting
  • What does it mean for the dot product to be
    negative?
  • What can we do about it?
  • A Lambertian sphere seen at several different
    lighting angles

15
Contoh diffuse light
16
Specular reflection
  • At the other extreme from Lambertian surfaces are
    perfectly smooth surfaces ideal specular
    reflectors
  • A light shining on a specular surface causes a
    bright spot called a specular highlight
  • The location of these highlights is a function of
    view direction, so we commonly refer to specular
    reflection as view-dependent

17
Snells laws
  • Reflection follows Snells laws
  • The incoming ray and reflected ray lie in a plane
    with the surface normal
  • The angle that the reflected ray forms with the
    surface normal equals the angle formed by the
    incoming ray and the surface normal ?l ?r

N
L
R
?l
?r
18
Non-ideal reflectors
  • Snells laws apply to ideal reflectors (mirrors,
    chrome)
  • Most surfaces are not ideal reflectors we need
    a way to model typical surfaces
  • Assume most light reflects according to Snells
    law, but some light reflects off the surface near
    the ideal angle due to imperfectly smooth
    microgeometry.

N
L
R
?l
?r
19
Phong lighting
  • The most common specular lighting model in
    computer graphics was suggested by Phong.
  • Though it has no physical basis, in practice it
    looks OK

N
L
R
V
?l
?r
?
20
Phong lighting
  • Whats nshiny, you ask?
  • It controls how fast the Phong reflectance term
    drops off as the view vector differs form the
    ideal reflectance vector.
  • What does nshiny do visually?

21
Phong lighting
  • As before, we can replace the cosine with a dot
    product, leaving us with simple (unit) vector
    math
  • How do we calculate R?

N
L
R
V
?l
?r
?
22
Calculating the reflection vector
N
L
R
?l
?r
23
Contoh specular lighting
24
Phong lighting examples
  • Spheres with different values of nshiny

25
Combining ambient, diffuse, and specular
26
Intensity attenuation
  • Light models commonly include attenuation of
    light due to distance and position.
  • The energy incident on a surface due to a light
    source falls off as the inverse of the squared
    distance between them.
  • If we applied this distance attenuation directly
    to the light model, the changes in light
    intensity would be too great near the light
    source and too small far away time for a hack.
  • We use this attenuation function

27
Spotlights
  • So far, we have a model for an omnidirectional
    light source, but many lights direct the majority
    of their energy.
  • We can use a term similar the the Phong lighting
    model to focus light in a given direction.
  • We can make a spotlight
  • omnidirectional by setting
  • ? 180?

?
L
D
28
Putting it all together
29
Putting it all together
30
Multiple lights
  • To support multiple lights, we need to sum the
    portions light-dependent calculations over all
    lights.
  • Care has to be taken to avoid having total
    reflected light exceed 1
  • Either clamp at the end, or
  • The sum of the material properties for a surface
    should be between 0 and 1. Each light intensity
    should be normalized to account for all lights.

31
Color
  • The preceding gives us the intensity light at one
    wavelength.
  • To do multispectral lighting, we need
    coefficients for each wavelength in the color
    model.
  • Both the surface and the light need a coefficient
    per wavelength colored lights and colored
    surfaces.
  • Its uncommon for shininess or attenuation to be
    wavelength dependent, but certainly could be done
    in the model.

32
OpenGL
  • OpenGL supports separate diffuse and specular
    coefficients for lights.
  • It also allows each light to have an ambient term
    (subject to attenuation) along with the global
    term we discussed.

33
OpenGL
  • OpenGL uses a simpler Phong model, replacing VR
    with NH.
  • The vector H is called the halfway vector it is
    between V and L.
  • For given L and V, the halfway vector is the
    direction of orientation of the surface which
    would give maximum specular reflection in the
    viewing direction.

?
N
H
L
R
V
?
Write a Comment
User Comments (0)
About PowerShow.com