Cs 445 645 introductory computer graphics
This presentation is the property of its rightful owner.
Sponsored Links
1 / 29

CS 445 / 645: Introductory Computer Graphics PowerPoint PPT Presentation


  • 47 Views
  • Uploaded on
  • Presentation posted in: General

CS 445 / 645: Introductory Computer Graphics. Light. Fiat Lux. Learn more about Paul Debevec’s research http://www.debevec.org/FiatLux/h. Administrivia. Assignment 3 Due Sunday, October 21 st at Midnight Midterm Exam Tuesday, October 23 rd See web page for reading material

Download Presentation

CS 445 / 645: Introductory Computer Graphics

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cs 445 645 introductory computer graphics

CS 445 / 645: Introductory Computer Graphics

Light


Fiat lux

Fiat Lux

  • Learn more about Paul Debevec’s research

    • http://www.debevec.org/FiatLux/h


Administrivia

Administrivia

  • Assignment 3 Due

    • Sunday, October 21st at Midnight

  • Midterm Exam

    • Tuesday, October 23rd

    • See web page for reading material

    • More review info in class after break


Lighting and shading

Lighting and Shading

  • Lighting Models

    • Ambient

      • Normals don’t matter

    • Lambert/Diffuse

      • Angle between surface normal and light

    • Phong/Specular

      • Surface normal, light, and viewpoint

  • Shading Models…


Applying illumination

Applying Illumination

  • We now have an illumination model for a point on a surface

  • Assuming that our surface is defined as a mesh of polygonal facets, which pointsshould we use?

  • Keep in mind:

    • It’s a fairly expensive calculation

    • Several possible answers, each with different implications for the visual quality of the result


Applying illumination1

Applying Illumination

  • With polygonal/triangular models:

    • Each facet has a constant surface normal

    • If the light is directional, the diffuse reflectance is constant across the facet


Flat shading

Flat Shading

  • The simplest approach, flat shading, calculates illumination at a single point for each polygon:

  • If an object really is faceted, is this accurate?


Is flat shading realistic for faceted object

  • For specular reflectance, direction to eye varies across the facet

Is flat shading realistic for faceted object?

  • No:

    • For point sources, the direction to light varies across the facet


Flat shading1

Flat Shading

  • We can refine it a bit by evaluating the Phong lighting model at each pixel of each polygon, but the result is still clearly faceted:

  • To get smoother-looking surfaceswe introduce vertex normals at eachvertex

    • Usually different from facet normal

    • Used onlyfor shading

    • Think of as a better approximation of therealsurface that the polygons approximate


Vertex normals

Vertex Normals

  • Vertex normals may be

    • Provided with the model

    • Computed from first principles

    • Approximated by averaging the normals of the facets that share the vertex


Gouraud shading

Gouraud Shading

  • This is the most common approach

    • Perform Phong lighting at the vertices

    • Linearly interpolate the resulting colors over faces

      • Along edges

      • Along scanlines

C1

c1 + t1(c2-c1)

  • This is what OpenGL does

  • Does this eliminate the facets?

  • C3

    C2

    c1 + t1(c2-c1) + t3(c1 + t2(c3-c1)- c1 + t1(c2-c1))

    c1 + t2(c3-c1)


    Gouraud shading1

    Gouraud Shading

    • Artifacts

      • Often appears dull, chalky

      • Lacks accurate specular component

        • If included, will be averaged over entire polygon

    C1

    C3

    C2

    Can’t shade that effect!


    Gouraud shading2

    Gouraud Shading

    • Artifacts

      • Mach Banding

        • Artifact at discontinuities in intensity or intensity slope

    C1

    C4

    C3

    C2

    Discontinuity in rateof color changeoccurs here


    Phong shading

    Phong Shading

    • Phong shading is not the same as Phong lighting, though they are sometimes mixed up

      • Phong lighting: the empirical model we’ve been discussing to calculate illumination at a point on a surface

      • Phong shading: linearly interpolating the surface normal across the facet, applying the Phong lighting model at every pixel

        • Same input as Gouraud shading

        • Usually very smooth-looking results:

        • But, considerably more expensive


    Phong shading1

    Phong Shading

    • Linearly interpolate the vertex normals

      • Compute lighting equations at each pixel

      • Can use specular component

    N1

    Remember: Normals used in

    diffuse and specular terms

    Discontinuity in normal’s rate of

    change is harder to detect

    N4

    N3

    N2


    Shortcomings of shading

    Shortcomings of Shading

    • Polygonal silhouettes remain

    Gouraud Phong


    Perspective distortion

    Perspective Distortion

    Imageplane

    Break up large polygonswith many smaller ones

    i

    i

    i

    i

    i

    i

    u

    u

    u

    u

    u

    u

    Z – into the scene

    Notice that linear interpolation in screen spacedoes not align with linear interpolation in world space


    Cs 445 645 introductory computer graphics

    Perspective Distortion

    Break up large polygonswith many smaller ones

    Imageplane

    Z – into the scene

    Notice that linear interpolation in screen spacedoes not align with linear interpolation in world space


    Interpolation dependent on polygon orientation

    i

    i

    Interpolation dependent on polygon orientation

    A

    Rotate -90oand colorsame point

    B

    C

    B

    A

    D

    D

    C

    Interpolate betweenAB and BC

    Interpolate betweenAB and AD


    Problems at shared vertices

    Problems at Shared Vertices

    Vertex B is shared by the two rectangles on the right, but not by the one on the left

    C

    H

    D

    The first portion of the scanlineis interpolated between DE and ACThe second portion of the scanlineis interpolated between BC and GHA large discontinuity could arise

    B

    G

    F

    E

    A


    Bad vertex averaging

    Bad Vertex Averaging


    Global illumination

    Global Illumination

    • We’ve glossed over how light really works

    • And we will continue to do so…

    • One step better

    • Global Illumination

      • The notion that a point is illuminated by more than light from local lights; it is illuminated by all the emitters and reflectors in the global scene


    The rendering equation

    The ‘Rendering Equation’

    • Jim Kajiya (Current head of Microsoft Research) developed this in 1986

    • I(x, x’) is the total intensity from point x’ to x

    • G(x, x’) = 0 when x/x’ are occluded and 1/d2 otherwise (d = distance between x and x’)

    • e(x, x’) is the intensity emitted by x’ to x

    • r(x, x’,x’’) is the intensity of light reflected from x’’ to x through x’

    • S is all points on all surfaces


    The rendering equation1

    The ‘Rendering Equation’

    • The light that hits x from x’ is the direct illumination from x’ and all the light reflected by x’ from all x’’

    • To implement:

      • Must handle recursion effectively

      • Must support diffuse and specular light

      • Must model object shadowing


    Recursive ray tracing

    Recursive Ray Tracing

    • Cast a ray from the viewer’s eye through each pixel

    • Compute intersection of this ray with objects from scene

    • Closest intersecting object determines color


    Recursive ray tracing1

    Recursive Ray Tracing

    • Cast a ray from intersected object to light sources and determine shadow/lighting conditions

    • Also spawn secondary rays

      • Reflection rays and refraction rays

      • Use surface normal as guide (angle of incidence equals angle of reflection)

      • If another object is hit, determine the light it illuminates by recursing through ray tracing


    Recursive ray tracing2

    Recursive Ray Tracing

    • Stop recursing when:

      • ray fails to intersect an object

      • user-specified maximum depth is reached

      • system runs out of memory

    • Common numerical accuracy error

      • Spawn secondary ray from intersection point

      • Secondary ray intersects another polygon on same object


    Recursive ray tracing3

    Recursive Ray Tracing

    • Still producing PhD’s after all these years

    • Many opportunities to improve efficiency and accuracy of ray tracing

      • Reduce the number of rays cast

      • Accurately capture shadows caused by non-lights (ray tracing from the light source)

      • Expensive to recompute as eyepoint changes


    Radiosity

    Radiosity

    • Ray tracing models specular reflection and refractive transparency, but still uses an ambient term to account for other lighting effects

    • Radiosity is the rate at which energy is emitted or reflected by a surface

    • By conserving light energy in a volume, these radiosity effects can be traced


  • Login