Cs 551 651 advanced computer graphics
Download
1 / 44

CS 551/651: Advanced Computer Graphics - PowerPoint PPT Presentation


  • 126 Views
  • Uploaded on

CS 551/651: Advanced Computer Graphics. Advanced Ray Tracing Radiosity. Administrivia. Quiz 1: Tuesday, Feb 20 Yes, I’ll have your homework graded by then (somehow) Normal written exam (oral later). Recap: Distributed Ray Tracing.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' CS 551/651: Advanced Computer Graphics' - clinton-sullivan


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 551 651 advanced computer graphics

CS 551/651: Advanced Computer Graphics

Advanced Ray Tracing

Radiosity

David Luebke 111/17/2014


Administrivia
Administrivia

  • Quiz 1: Tuesday, Feb 20

    • Yes, I’ll have your homework graded by then (somehow)

    • Normal written exam (oral later)

David Luebke 211/17/2014


Recap distributed ray tracing
Recap: Distributed Ray Tracing

  • Distributed ray tracing: an elegant stochastic approach that distributes rays across:

    • Pixel for antialiasing

    • Light sourcefor soft shadows

    • Reflection function for soft (glossy) reflections

    • Time for motion blur

    • Lens elements for depth of field

  • Cook: 16 rays suffice for all of these

David Luebke 311/17/2014


Recap backwards ray tracing
Recap: Backwards Ray Tracing

  • Two-pass algorithm:

    • Rays are cast from light into scene

    • Rays are cast from the eye into scene, picking up illumination showered on the scene in the first pass

  • Backwards ray tracing can capture:

    • Indirect illumination

    • Color bleeding

    • Caustics

David Luebke 411/17/2014


Recap backwards ray tracing1
Recap: Backwards Ray Tracing

  • Arvo: illumination mapstile surfaces with regular grids, like texture maps

    • Shoot rays outward from lights

    • Every ray hit deposits some of its energy into surface’s illumination map

      • Ignore first generation hits that directly illuminate surface (Why?)

    • Eye rays look up indirect illumination using bilinear interpolation

David Luebke 511/17/2014


Recap radiosity
Recap: Radiosity

  • Ray tracing:

    • Models specular reflection easily

    • Diffuse lighting is more difficult

    • View-dependent, generates a picture

  • Radiosity methods explicitly model light as an energy-transfer problem

    • Models diffuse interreflection easily

    • But only diffuse; no shiny (specular) surfaces

    • View-independent, generates a 3-D model

David Luebke 611/17/2014


Recap radiosity1
Recap: Radiosity

  • Basic idea: represent surfaces in environment as many discrete patches

    • A patch, or element, is a polygon over which light intensity is constant

    • Model light transfer between patches as a system of linear equations

    • Solve this system for the intensity at each patch

    • Solve for R,G,B intensities; get color at each patch

    • Render patches as colored polygons in OpenGL

David Luebke 711/17/2014


Recap fundamentals
Recap: Fundamentals

  • Definition:

    • The radiosity of a surface is the rate at which energy leaves the surface

      • Radiosity = rate at which the surface emits energy + rate at which the surface reflects energy

  • Simplifying assumptions

    • Environment is closed

    • All surfaces have Lambertian reflectance

    • Surface patches emit and reflect light uniformly over their entire surface

David Luebke 811/17/2014


Radiosity
Radiosity

  • For each surface i:

    Bi = Ei + i Bj Fji(Aj / Ai)

    where

    Bi, Bj= radiosity of patch i, j

    Ai, Aj= area of patch i, j

    Ei= energy/area/time emitted by i

    i = reflectivity of patch i

    Fji = Form factor from j to i

David Luebke 911/17/2014


Form factors
Form Factors

  • Form factor: fraction of energy leaving the entirety of patch i that arrives at patch j, accounting for:

    • The shape of both patches

    • The relative orientation of both patches

    • Occlusion by other patches

  • We’ll return later to the calculation of form factors

David Luebke 1011/17/2014


Form factors1
Form Factors

  • Some examples…

Form factor:

nearly 100%

David Luebke 1111/17/2014


Form factors2
Form Factors

  • Some examples…

Form factor:

roughly 50%

David Luebke 1211/17/2014


Form factors3
Form Factors

  • Some examples…

Form factor:

roughly 10%

David Luebke 1311/17/2014


Form factors4
Form Factors

  • Some examples…

Form factor:

roughly 5%

David Luebke 1411/17/2014


Form factors5
Form Factors

  • Some examples…

Form factor:

roughly 30%

David Luebke 1511/17/2014


Form factors6
Form Factors

  • Some examples…

Form factor:

roughly 2%

David Luebke 1611/17/2014


Form factors7
Form Factors

  • In diffuse environments, form factors obey a simple reciprocity relationship:

    Ai Fij = Ai Fji

  • Which simplifies our equation:Bi = Ei + i Bj Fij

  • Rearranging to:Bi - i Bj Fij = Ei

David Luebke 1711/17/2014


Form factors8
Form Factors

  • So…light exchange between all patches becomes a matrix:

  • What do the various terms mean?

David Luebke 1811/17/2014


Form factors9
Form Factors

1 - 1F11 - 1F12 … - 1F1n B1E1

- 2F21 1 - 2F22 … - 2F2n B2E2

. . … . . .

. . … . . .

. . … . . .

- pnFn1- nFn2 … 1 - nFnn Bn En

  • Note: Ei values zero except at emitters

  • Note: Fii is zero for convex or planar patches

  • Note: sum of form factors in any row = 1 (Why?)

  • Note: n equations, n unknowns!

David Luebke 1911/17/2014


Radiosity1
Radiosity

  • Now “just” need to solve the matrix!

    • W&W: matrix is “diagonally dominant”

    • Thus Guass-Siedel must converge (what’s that?)

  • End result: radiosities for all patches

  • Solve RGB radiosities separately, color each patch, and render!

  • Caveat: for rendering, we actually color vertices, not patches (see F&vD p 795)

David Luebke 2011/17/2014


Radiosity2
Radiosity

  • Q: How many form factors must be computed?

  • A: O(n2)

  • Q: What primarily limits the accuracy of the solution?

  • A: The number of patches

David Luebke 2111/17/2014


Roadmap
Roadmap

  • So, we know the basic radiosity algorithm

    • Represent light transfer as a matrix

    • Solve the matrix to get radiosity (=color) per patch

  • Next topics:

    • Evaluating form factors

    • Progressive radiosity: viewing an approximate solution early

    • Hierarchical radiosity: increasing patch resolution on an as-needed basis

David Luebke 2211/17/2014


Form factors10
Form Factors

  • Calculating form factors is hard

    • Analytic form factor between two polygons in general case: open problem till last few years

  • Q: So how might we go about it?

  • Hint: Clearly form factors are related to visibility: how much of patch j can patch i “see”?

David Luebke 2311/17/2014


Form factors hemicube
Form Factors: Hemicube

  • Hemicube algorithm: Think Z-buffer

    • Render the model onto a hemicubeas seen from the center of patch i

    • Store item IDs instead of color

    • Use Z-buffer to resolve visibility

    • See W&W p 278

  • Q: Why hemicube, not hemisphere?

David Luebke 2411/17/2014


Form factors hemicubes
Form Factors: Hemicubes

  • Advantages of hemicubes

    • Solves shape, size, orientation, and occlusion problems in one framework

    • Can use hardware Z-buffers to speed up form factor determination (How?)

David Luebke 2511/17/2014


Form factors hemicubes1
Form Factors: Hemicubes

  • Q: What are some disadvantages of hemicubes?

    • Aliasing! Low resolution buffer can’t capture actual polygon contributions very exactly

      • Causes “banding” near lights (plate 41)

    • Actual form factor is over area of patch; hemicube samples visibility at only center point on patch (So?)

David Luebke 2611/17/2014


Form factors ray casting
Form Factors: Ray Casting

  • Idea: shoot rays from center of patch in hemispherical pattern

David Luebke 2711/17/2014


Form factors ray casting1
Form Factors: Ray Casting

  • Advantages:

    • Hemisphere better approximation than hemicube

      • More even sampling reduces aliasing

    • Don’t need to keep item buffer

    • Slightly simpler to calculate coverage

David Luebke 2811/17/2014


Form factors ray casting2
Form Factors: Ray Casting

  • Disadvantages:

    • Regular sampling still invites aliasing

    • Visibility at patch center still isn’t quite the same as form factor

    • Ray tracing is generally slower than Z-buffer-like hemicube algorithms

      • Depends on scene, though

      • Q: What kind of scene might ray tracing actually be faster on?

David Luebke 2911/17/2014


Form factors11
Form Factors

  • Source-to-vertex form factors

    • Calculating form factors at the patch vertices helps address some problems:

      for every patch vertex

      for every source patch

      sample source evenly with rays

      visibility = % rays that hit

    • Q: What are the problems with this approach?

David Luebke 3011/17/2014


Form factors12
Form Factors

  • Summary of form factor computation

    • Analytical:

      • Expensive or impossible (in general case)

    • Hemicube

      • Fast, especially using graphics hardware

      • Not very accurate; aliasing problems

    • Ray casting

      • Conceptually cleaner than hemicube

      • Usually slower; aliasing still possible

David Luebke 3111/17/2014


Substructuring
Substructuring

  • More patches  better results

  • Problem: # form factors grows quadratically with # patches

  • Substructuring: adaptively subdivide patches into elements where high radiosity gradient is found

David Luebke 3211/17/2014


Substructuring1
Substructuring

  • Elements are second-class patches:

    • When a patch is subdivided, form factors are computed from the elements to other patches

    • But form factors from the other patches to the elements are not computed

      • However, the form factors from other patches to the subdivided patch are updated using more accurate area-weighted average of elements

David Luebke 3311/17/2014


Substructuring2
Substructuring

  • Elements vs. patches, cont.

    • Elements “gather” radiosity from other patches

    • But those other patches only gather radiosity from the “parent” patch, not the individual elements

    • So an element’s contribution to other patches is approximated coarsely by it’s patch’s radiosity

David Luebke 3411/17/2014


Substructuring3
Substructuring

  • Bottom line:

    • Substructuring allows subpatch radiosities to be computed without changing the size of the form-factor matrix

    • Show examples:

      • W&W plate 38, F&vD plate III.21

    • Note: texts aren’t clear about adaptive subdivision vs substructuring

David Luebke 3511/17/2014


Progressive radiosity
Progressive Radiosity

  • Good news: iterative solver of radiosity matrix will converge

  • Bad news: can take a longtime

  • Progressive radiosity: reorder computation to allow viewing of partial results

David Luebke 3611/17/2014


Progressive radiosity1
Progressive Radiosity

  • Radiosity as described uses Gauss-Seidel iterative solver

    • Must do an entire iteration to get an estimate of patch radiosities

    • Must precompute and store all O(n2) form factors

David Luebke 3711/17/2014


Progressive radiosity2
Progressive Radiosity

1 - 1F11 - 1F12 … - 1F1n B1E1

- 2F21 1 - 2F22 … - 2F2n B2E2

. . … . . .

. . … . . .

. . … . . .

- pnFn1- nFn2 … 1 - nFnn Bn En

  • Evaluating row i estimates radiosity of patch i based on all other patches

  • We say the patch gathers light from the environment

David Luebke 3811/17/2014


Progressive radiosity3
Progressive Radiosity

  • Progressive radiosity shoots light from a patch into the environment:

    Bjdue to Bi = j Bj Fjij rather thanBidue to Bj = i Bj Fijj

  • Given an estimate of Bi, evaluating this equation estimates patch i’s contribution to the rest of the scene

David Luebke 3911/17/2014


Progressive radiosity4
Progressive Radiosity

  • A problem: evaluating the equationBjdue to Bi = j Bj Fjij requires knowing Fji for each patch j

  • Determining these values requires a hemicube computation per patch

  • Use reciprocity relationship to getBjdue to Bi = j Bj Fij(Ai/Aj)j

David Luebke 4011/17/2014


Progressive radiosity5
Progressive Radiosity

  • Now evaluation requires only a single hemicube about patch i

    • Compute, use, and discard form factors

    • Drastically reduces total storage!

  • Reorder radiosity computation:

    • Pick patch w/ highest estimated radiosity

      • Shoot to all other patches

      • Update their estimates

    • Pick new “brightest” patch and repeat

David Luebke 4111/17/2014


Progressive radiosity6
Progressive Radiosity

  • We can look at the scene after every iteration through this loop

  • Q: How will it look after 1 loop?

  • Q: 2 loops?

  • Q: If m = # of light sources, how will it look after m loops? After 2m loops?

David Luebke 4211/17/2014


Progressive radiosity7
Progressive Radiosity

  • Subtleties:

    • Pick patch with most energy to shoot

      • Energy = radiosity * area = Bj Ai

    • A patch may be selected to shoot again after new light has been shot to it

    • So don’t shoot Bj , shoot Bj, the amount of radiosity patch i has received since it was last shot

David Luebke 4311/17/2014


The end
The End

David Luebke 4411/17/2014


ad