Recent Changes - Search:

CS679-2007 Web

Login

AdvancedRendering

Topics du Jour:

  1. What to do for the rest of the class?
  2. Graphics Hardware and Shading basics
  3. Fancy Lighting and Other Tricks

1.  What to do with the rest of the class?

Anti-Climax of putting the project in the middle.

Lots of topics to discuss:

  • advanced rendering / shading
  • physics
  • ai
  • animation
  • procedural synthesis

Problems:

  1. how to pick which ones
  2. brief smattering vs. enough time to have meat
  3. keeping interest
  4. getting rough surveys from reading
  5. making sure you learn something
  6. everyone has different interests

2.  Shader Programming

Mechanics:

  • talk about some basic ideas today
  • shader assignment (available later today) to force you to learn stuff on your own
    • group discussion after you've all learned something

2.1  Prelude: Why GPU Programming

  • increasingly important for games
    • especially consoles
  • GPUs are really fast
    • more FLOPS / memory bandwidth than CPUs
    • for pretty specialized computations - but becoming less specialized
  • large portion of the compute cycles on a modern PC/console
    • do intense graphics
    • use for other purposes
  • makes you re-think what interactive graphics should be / could be

2.2  Background: The Fixed Function Pipeline

  • primitives
  • vertices
  • assembly
  • rasterization
  • texture
  • fragments
  • tests

Vertex:

  • inputs: position, normal, color, texture coord
    • define vertex to be these things
    • same position, different normal = different vertex
  • other data is "global"
    • lights, constants, other variables
  • output = vertex (all info) - but in a new space / color
  • normally...
    • multiply by transformation matrices
    • compute lighting model

Fragments:

  • for a given pixel location
  • inputs: position, triangle info (interpolated) - includes x,y,z
    • texture, pixel value (for blending)
  • output: color, stencil value, z-value, alpha value
    • but can write to frame buffer or texture

2.3  Execution Model

  • Vertex program - what happens for every vertex
  • Fragment program - what happens for each fragment
  • need to draw primitives to generate vertices/fragments
  • only data you get is:
    • per vertex/fragment "graphics stuff", more global data
    • anything in textures
  • need to have both a fragment and vertex program (in current stuff)
    • if you want the "normal" pipeline, you need to write a program
  • naming confusion: "shader" really means a set of shaders
    • possibly with an execution pathway
  • multi-pass
    • multiple writes to frame buffer
    • render to other targets and re-use

2.4  Language Concepts

  • used to have to do this in assembly language
    • now high level languages
    • different languages very similar
    • GLSL, HLSL, Cg
  • compile on the fly (in the driver)
  • lots of stuff deals with vectors (3 vectors, 4 vectors)
    • made a 1st class object
  • types of variables
    • local variables
    • const - constants
    • uniform - set once for a primitive (outside of begin/end)
    • attribute - set per vertex by the calling program
    • varying - set by interpolation
    • samplers - for accessing textures
  • input and output
    • done by reading and writing special variables

2.5  Using this

  • in a program
    • compile the program (and hope for the best)
    • attach to the program
    • draw the geometry
  • in RenderMonkey
    • drag and drop!

3.  More Advanced Lighting

3.1  Why advanced lighting?

What's wrong witht the basic lighting?

Practically:

  • misses important cues
    • realism -> mood
    • shape comprehension
    • dynamics (appearance changes as objects move)

Technically:

  • simple lighting model
  • local

Non-Local Effects are a big topic

  • shadows
  • reflections
  • spill / inter-reflection

Holy Grail: Global Illumination

  • necessarily expensive - since lots of interactions

Really...

  • Hacks to achieve specific effects.
  • Some General Tricks

3.2  Some Rendering Theory

  • Micro-geometry
  • probabalistic nature

Bi-Directional Reflectance Distributions

  • in/out relationships
  • output color as an integral over a range
    • reverse - input gives a distribution (laser)
  • material properties
    • lobes
    • complex models / captured models

3.3  Theory into Practice

  • integrals become sums over point lights

Hack 1: Hemisphere lighting

  • Sky is blue
  • Ground is brown
  • any point integrates
  • assume diffuse, integrate over the whole hemisphere (cosines)
  • cheat - we know we're partway between blue/brown, interpolate based on 1 angle

Hack 2: Environment Maps for Lighting

  • remember environment maps?
    • assume world is distant (so all points are at center)
    • incoming direction = normal * outgoing
    • where to look in map just a function of eye and normal
  • assume totally shiny
  • color is lookup in environment map
  • could use for lighting, if object is a mirror ball

Hack 3: Filtered Environment Maps

  • real objects look at map over a range of directions
  • integrate
  • filter environment map (pre-integrate for each place)
  • generally, only need low frequencies (unless you have a mirror)
  • filtering is slow
  • trick - do the fourier transform
    • fast
    • makes low frequencies easy
    • integration (convolution) becomes summation
  • how do we do fourier transform of an environment map?
  • spherical harmonics
    • like sine/cosine on line, but on a sphere

Hack 4: Self-Shadowing

Self-Shadowing is REALLY important for things to look good

Ambient Occlusion - for every point, compute the amount of light from "outside"

tricks to compute it faster, but basically brute force

Not quite a hack 5: Precomputed Radiance Transfer

Imagine static object (new work relaxes this):

  • for every point, make a map of what directions it gets light from

For diffuse case:

  • have a map of lights
  • integrate product of light and transport (take dot product)

Good news:

  • shadows come for free (and soft shadows)

Problems:

  • need to store map at every point (use spherical harmonics)
  • made some big assumptions

Hot topic:

  • make it work with specular (high frequencies)
  • make it dynamic
  • make it more efficient
  • make it work in games! (yes, people are doing it!)
History - Print - Recent Changes - Search
Page last modified on April 09, 2007, at 08:32 PM