comp 102 computer graphics and...
TRANSCRIPT
COMP 102Computer Graphics
and Animation
Paul Kry
4 November, 2013
“There is no reason anyone would want a computer in their home.”Ken Olson, founder and president of DEC, 1977
“640K ought to be enough for anybody.”Bill Gates, cofounder of Microsoft, 1981
“Computers are useless. They can only give you answers”
Pablo Picasso
Meats Meier
Art
Kenneth A. Huff
Games
Movies
Visualization
NASA[Li et al., 2007]
CM Labs, crane simulator
Training
Boeing 747 flight simulator
Microsoft flight simulator
What is Computer Graphics?
• A vast field that encompasses pretty much anything related to computer generated images– Modeling, rendering, animation,
image processing, visualization, interactive techniques, etc.
[example assignments and projects from 557 and 559]
Computer Graphics
Mathematics made visible
Evolution of computing environments
• Graphics has been a key to technology growth – Graphical user interfaces– Desktop publishing – Visualization– Gaming consoles
• Hardware revolution drives everything– price/performance
improving exponentially (Moore’s Law)
– Graphics processors oneven faster exponentials
[van Dam]
Date
Price
CPU
Memory
Storage
Monitor
Devices
GUI
1984 2012
$2500 $2000
8 MHz 3.1 GHz (Quad)
128KB RAM 4.0GB DDR2 SDRAM
(1 GB on GPU)
400KB Floppy 1TB Hard Disk
9” Black&White 27” Color512 x 342
68 dpi2560 x 1440
108 dpi
MouseKeyboard
MouseKeyboard
Desktop WIMP Desktop WIMP
+28
x .8
x 387(x 1550)
x 31250
x 2500000
x 3
x 21
x 1.6
samesame
same
Original Macintosh New iMac 27”
[van Dam]
Graphics Processing Unit (GPU)Not part of the previous comparison
GPUs now part of every machine,
arguably more powerful than CPUs
and programmable
2012
4,000,000,00010-Core Xeon
GTX680
Outline
• Geometry representation
• Rendering techniques
• Animation introduction
Representing Geometry
• Parametric / Explicit
– Points
– Line segments (2 points)p(t) = a t + b (1-t) t=[0,1]
– Triangles (3 points)
– Quadrilaterals (4 points)
– Parametric surfaces(x,y,z) = f(u,v)
• Implicit
– Geometry defined by the 3D points that satisfy
F(x,y,z) = 0
– Example: a planeF(x,y,z) = ax + by + cz + d
– Example: a sphereF(x,y,z) = x2 + y2 + z2 - 1
b
a
What is the best representation?
Where does geometry come from?
Where does geometry come from?
Artists
CAD models
[ES3DStudios][Mudbox]
Where does geometry come from?
Measurement• Multi camera stereo
• Laser scans
• Medical scans
[Beeler et al 2010]
Where does geometry come from?Procedural• Noise
• Fractals
• L-systems
• Scripts
Where does geometry come from?
Physically Based Modeling• Shapes produced through physics simulation
[Thürey et al. 2010] [Bridson et al. 2002]
Drawing Geometry
• Object Order Rendering
– Uses points, lines, and triangles(other geometry is converted to these primitives)
– Points defining primitives are projected onto the viewing plane, and rasterized (filled in)
• Image Order Rendering
– Called ray tracing (or ray casting) as a ray is generated for each pixel in the image
– Find intersections between rays and scene geometry
Object Order Rendering• Points, lines, and triangles
– All are defined by points
[Durand]
Object Order Rendering
Points are projected onto the image plane (left)
Triangle is rasterized (right)
[Durand]
Rasterization / Scan Conversion
• Drawing a line– For horizontal, vertical and
diagonal lines all pixels lie on ideal line
– For lines at arbitrary angle, pick pixels closest to ideal line
– Aliasing “Jaggies” fixed by adjusting intensity
Visibility • Painter’s algorithm
– Sort back to front
– Draw!
– Doesn’t always work...
[Durand]
Visibility • Binary space partition
– Linear time back to front sort
– Key to 3D games before consumer level GPUs (Doom 1993)
– Still important in modern games for culling geometry
[Durand]
Visibility • Z-buffer
– Store depth at every pixel
– Compare when rasterizing
Texture Mapping
Lighting / Shading
• How much light reflected to the eye?
• Depends on angles, materials
• What if light is occluded?
Object Order Rendering Summary
• FAST! Used for most interactive applications
• Also used for most movie production (e.g., Renderman used for Pixar films)
• Consumer graphics cards can render millions of triangles per frame
• Tricky to render realistic light transport (soft shadows, glossy reflections)
Image Order Rendering
• Follow light path in reverse, back toward the light
– Ray tracing finds the intersection of scene geometry with a ray starting at the eye and going through each pixel of the image plane.
Ray Tracing
• Cast rays from viewpoint through each pixel
• Lots of rays to cast... Expensive!
[Durand]
Ray Tracing
• Deal with shadows by casting more rays
– Cast rays from visible point towards lights
[Durand]
Reflection and Refraction
Relatively easy, just cast more rays
NV
IDIA
Op
tix
Motion Blur
Relatively easy, just cast more rays
Co
ok e
t a
l. 1
98
4 (
Lu
ca
sfilm
)
Depth of Field
Relatively easy, just cast more rays
Lu
is A
lma
za
n(V
-Ra
y)
Lighting / Shading
• The full problem is actually much more complex!!!
– Light is everywhere and can even be scattered beneath the surface of materials
– Global illumination (holy grail of rendering)
[spin99, GELATO]
Ray Tracing Global Illumination• Even more rays to cast!
Super Expensive!
• Possible through careful sampling (e.g., Monte Carlo methods) and path tracing (working both from lights and viewer)[Durand]
“If you were plowing a field, which would you rather use: Two strong oxen or 1024 chickens?”
Seymour Cray
• NVIDIA GTX680 (2012)
• 3.5 billion transistors
• 1536 unified shaders
• IBM Cell processor
• PS3 (2005)
• 1 PPE + 8 SPE
Real time ray tracing
• 2007 - IBM
300000 triangles, 60 fps, 1080p, 14 Cell processors (PS3)http://www.youtube.com/watch?v=zKqZKXwop5E
• Today – NVIDIA
OPTIX / CUDA
2496 processors in TESLA K20
Design Garage Demo (2010)http://www.youtube.com/watch?v=kcP1NzB49zU
Image Order Rendering Summary
• Typically slower but easily parallelizable
• Smart data structures necessary to speed up ray scene intersections
• Easy to generate a variety of light transport effects, such as reflections on smooth surfaces
• Sampling provides a straightforward approach to many rendering issues
– depth of field, motion blur, area lights, BRDFs, antialiasing, etc.
2D Images of 3D scenes
• The goal of rendering is typically to create images that provide information about a 3D world, much in the same way a camera can be used to take a picture
– Why does this work?
– What influences our perception of depth?
reflection
stereopsisdefocus
fog / atmospheric
shading
texture gradient
occlusion
vergenceaccommodation
shadows
perspective size familiarityheight in image
Computer Animation
Where does motion come from?
• Artist based
– Key frames
• Physically based
– Simulation / Control
• Phenomenological
– Procedural animation
• Reality based
– Motion capture
Artists / Animators
Key frames
Artists / Animators
Inverse kinematics [Nakamura]
Blend Shapes
Physically based simulation
Physically based simulation
[Fedkiw et al.]
Procedural Animation
• Flocking behaviour and crowds
Boids [Reynolds 1987] Aggregate Dynamics [Narain et al. 2009]
Procedural Animation
Curl noise for procedural fluid flow, Bridson
Motion Capture
• Directly captures subtleties of human motion
Motion Capture
Andy SerkisGollum
Motion Capture
Brian Carpenter
Motion Capture
[Softimage Facerobot]
Motion Capture
[Park, Hodgins, 2006]
Where does motion come from?
• Artist based– Key frames, blend shapes, inverse kinematics,
other tools
• Physically based– Simulation of equations of motion,
– Simulation of motor control
• Phenomenological– Procedural animation
• Reality based – Motion capture
Time Permitting
A quick introduction to physically based animation
Physically Based Computer Animation
• Differences from engineering and physics– Computer animation
• High visual detail
• High performance
• Low memory consumption
– Engineering and Numerical Physics
• Momentary visual details not needed
• Predict long term behaviour and or high precision
• High computation time and memory consumption
It Came From Beneath The Sea (1955)“Fed up with traffic noise, Ray Harryhausen's giant six-tentacledoctopoid (cut back from eight to reduce stop-motion animation time),demolishes the Golden Gate Bridge.”
Motivation for physically based animation
• Physics in games?
– Add reality things move as you would expect
– Add variety different things happen
– Add fun
• Secondary animation
• Physics in training simulations?
• Physics in special effects?
• Why not? Hard?
Physically Based Animation
M x = f(x,x).. .
x(t)
Example forces:
gravity, f = m g
wind / drag, f = b x
springs, f = k x
user interaction, etc...
.
hard to compute exactly
x(0)
Discrete time steps
M x = f(x,x).. .
x(t) hard to compute exactly
x(0)
Discrete time steps
M x = f(x,x).. .
x0 = x(0)
x1 = x(h)
x2 = x(2h)
x(t) hard to compute exactly
Discrete time steps
M x = f(x,x).. .
x0
x1
x2
Numerical IntegrationForward Euler
x1 = x0 + h x0
..x = M-1 f(x,x).. . .
x0
x1
x2
.
Numerical IntegrationForward Euler
.x1 = x0 + h x0
x = M-1 f(x,x).. .
M-1 f(x0,x0).
x1 = x0 + h.
x0
x1
x2
.
Numerical IntegrationSymplectic Euler
.x1 = x0 + h x1
M-1 f(x0,x0).
x1 = x0 + h.
x0
x1
x2
.
Numerical IntegrationBackwards Euler
.x1 = x0 + h x1
M-1 f(x1,x1).
x1 = x0 + h.
x0
x1
x2
.