Beruflich Dokumente
Kultur Dokumente
TO
COMPUTER
GRAPHIC S
TAs, John Hughes, and Andy van Dam Significantly updated in 2001 and 2002 by John Alex (former 123 TA and Pixarian, who got his Ph.D. at MIT), in 2008 by Matthew Jacobs See also Chapter 14 in the book
Image from: http://www.oyonale.com/modeles.php?lang=en&page=40
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Many techniques for achieving varying amounts of realism within each category Achieving realism usually requires trade-offs
realistic in some categories, not in others concentrate on the aspects most useful to your application
INTRODUCTION
TO
COMPUTER
GRAPHIC S
http://www.logoi.com/pastimages/img/king_kong_2.jpg
In the early days of computer graphics, focus was primarily directed towards producing still images
realism typically meant approaching photorealism. Goal: to accurately reconstruct a scene at a particular slice of time emphasis placed on accurately modeling geometry and light reflection properties of surfaces
http://www.solarnavigator.net/films_movies_actors/actors_films_images/king _kong_empire_state_building_sunset.jpg
With the increasing production of animated graphics (commercials, movies, special effects, video games, cartoons) new standard of realism important: Behavior over time:
character animation natural phenomena: cloth, fur, hair, skin, smoke, water, clouds, wind newtonian physics: things that bump, collide, fall, scatter, bend, shatter, etc.
Some of which is now calculated on a dedicated physics card! (eg. NVidia PhysX)
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Real-time requirements drastically reduce time available for geometric complexity, behavior simulation, rendering, etc. Additionally, any media that involves user interaction (e.g., all of the above) also requires real-time interaction handling
Rendered image
Andries van Dam
Real-time interaction
October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Trade-offs (1/5)
Cost vs. Quality
Many computer graphics media (e.g., film vs. video vs. monitor) Many categories of realism to consider (far from exhaustive):
geometry behavior rendering interaction
Worst-case scenario (e.g., IVR): must attend to all of these categories within an extremely limited time-budget Optimal balance of techniques for achieving realism highly depends on context of use:
medium user content resources (especially hardware)
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Trade-offs (2/5)
Medium
User
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Trade-offs
Content
(3/5)
movie special-effects pack as much astonishment as possible into budget: every trick in book
conversely, CAD model rendering typically elides detail for clarity, and fancy effects interfere with communication
Scientific visualizations show artifacts and holes in data, dont smooth them out. Also, dont introduce artifacts due to geometric or rendering approximations (e.g., contouring). Fancy effects (such as depth-of-field or excessive specular highlights) may interfere with communication or understanding
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Trade-offs
Resources
Intel 286 (1989)
wireframe bounding boxes
(4/5)
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Trade-offs (5/5)
Computing to a time budget (time-critical algos)
A vast array of techniques have been developed for generating realistic geometry, behavior, rendering The best can often be traded for the good at a much lower computational price We call bargain-basement deals hacks Some techniques use progressive refinement (or its inverse, graceful degradation): the more time we spend, the better output we get.
Excellent for situations when we want the best quality output we can get for a fixed period of time, but we cant overshoot our time limit (e.g., IVR surgery!). Maintaining constant update rates is a form of guaranteed Quality of Service (a networking term). web image downloads progressive refinement for extremely large meshes
see also slide 11 and 14
http://www.equinox3d.com/renderer.html
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Digression - Definitions
Texture-Maps: map an image onto surface geometry to create appearance of fine surface detail. A high level of realism may require many layers of textures. Environment-Maps: multiple images (textures) which record global reflection and lighting on object. These images are resampled during rendering to extract view- specific information which is then applied as texture to object. Bump-Maps: fake surface normals by applying height field (intensities in the map indicate height above surface). From height field calculate gradient across surface and use this to perturb the surface normal. Normal-Maps: similar to bump-maps. Instead of using grayscale image to calculate the normals, pre-generate normals from high-resolution model and store result in the low-resolution polygonal model. Shadow-Maps: generate shadow texture by capturing silhouettes of objects as seen from the light source. Project texture onto scene.
Andries van Dam October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesGeometry (1/4)
The Hacked Texture mapping: excellent way to fake fine surface detailmore often used to fake geometry than to add pretty colors more complicated texture mapping strategies such as polynomial texture maps use image-based techniques for added realism
coefficients of polynomials stored per texture pixel to recreate surface color under varying lighting conditions
The Good Polygonization: very finely tessellated meshings of curved surfaces Polys easily converted to subdivision surfaces (right). More on this later massively hardwareaccelerated!
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesGeometry (2/4)
The Best
Splines
no polygons at all! continuous mathematical surface representations (polynomials) 2D and 3D curved surfaces: Non-Uniform Rational BSplines (NURBS) control points high order polynomials are hard to work with used a lot in computer-aided designs, engineering
http://devworld.apple.com/dev/techsupport/develop/issue25/schneider.html
A cubic Bzier arc (C) with its control polygon (P), http://www.rw-designer.com/NURBS
F(x,y,z) = ((x^2*(1-x^2)-y^2)^2+0.5*z^2-f*(1+b*(x^2+y^2+z^2)) = 0
http://xahlee.org/surface/bretzel2/bretzel2.html
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
The Best
TechniquesGeometry (3/4)
Subdivision Surfaces
recursively apply a refinement scheme , i.e., a procedural smoothing, to a given mesh such that an infinite number of applications produces the limit subdivision surface (we use some finite number) avoids gapping and tearing between features supports creases (selective subdivision) allows multi-resolution deformations (editing of lower resolution representation of surface)
Wikipedia
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesGeometry (4/4)
The Gracefully Degraded
Sprites: 2D/3D image/animation integrated into a larger animation Level-of-Detail(LOD): as object gets farther away from viewer, replace it with a lower-polygon version or lower quality texture map. Discontinuous jumps in model detail
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (1/9)
Good Hacks
Easily implemented in hardware: fast! Use polygons Only calculate lighting at polygon vertices, from point lights For non-specular (i.e., not perfectly reflective), opaque objects, most light comes directly from the lights (locally), and not globally from other surfaces in the scene Local lighting approximations
diffuse Lambertian reflection: only accounts for angle between surface normal and vectors to the light source. fake specular spots on shiny surfaces: Phong lighting
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (2/9)
Example: Doom 3
Few polygons (i.e., low geometric complexity (a.k.a. scene complexity)) Purely local lighting calculations Details created by texturing everything with precomputed texture maps
surface detail smoke, contrails, damage and debris even the lighting and shadows are done with textures sprites used for flashes and explosions
www.igniq.com
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (3/9)
The Best: Global Illumination
Find out where all the light entering a scene comes from, where and how much it is absorbed, reflected or refracted, and all the places it eventually winds up Ray-tracing is oldest technique, used for specular reflections. Radiosity is used for calculating scenes which are purely diffuse, but neither is physically accurate Newer methods include photon mapping and MLT (more later) Ray-tracing. Avoid forward tracing infinitely many light rays from light sources to eye. Work backwards to do viewer/pixel-centric rendering: shoot viewing rays from viewers eyepoint through each pixel into scene, and see what objects they hit. Return color of object struck first. If object is transparent or reflective, recursively cast ray back into scene and add in reflected/refracted color
Turner Whitted, 1980 moderately expensive to solve embarrassingly parallelcan easily use parallel computer or networked workstations models simple lighting equation (e.g., ambient, diffuse and specular) for direct illumination but only perfectly specular reflection for indirect (global) illumination Photon Mapping, Nong Li, 2006
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (4/9)
Ray Tracing (cont.)
Ray tracing good for: shiny, reflective, transparent surfaces such as metal, glass, linoleum. Can produce:
sharp shadows (dont exist in real life) specular highlights transparency
Ray tracing very bad at rendering dull, diffuse surfaces (matte wall or chalk, for instance)
http://en.wikipedia.org/wiki/Caustic_(optics)
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (5/9)
Radiosity (Energy Transport) - Diffuse
Scene-centric rendering. Break scene up into small surface patches and calculate how much light from each patch contributes to every other patch. Circular problem: some of patch A contributes to patch B, which contributes some back to A, which contributes back to B, etc. Very expensive to solveiteratively solve system of simultaneous equations
viewer-independentbatch preprocessing step followed by real-time, view-dependent display
Cornell University
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (6/9)
Radiosity (cont.)
Good for: indirect (soft) lighting, color bleeding, soft shadows, indoor scenes with matte surfaces. As we live most of our lives inside buildings with indirect lighting and matte surfaces, this technique looks remarkably convincing Bad at capturing specular/shiny surfaces such as glass Even better results can be obtained by combining radiosity with ray-tracing Various methods for doing this. Looks great! Really expensive!
www.povray.com
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (7/9)
The Gracefully Degraded Best
Selectively ray-trace. Usually only a few shiny/transparent objects in a given ray-traced scene. Can perform local lighting equations on matte objects, and only ray-trace the pixels that fall precisely upon the shiny/transparent objects Calculate radiosity at vertices of the scene once, and then use this data as the vertex colors for Gouraud shading (only works for diffuse colors in static scenes)
raytrace
http://www.okino.com/conv/imp_jt.htm
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (8/9)
The Real Best: Sampling Realistically
The Kajiya rendering equation (covered in CS224 by Spike) describes light transport in detail impossible to compute analytically! previous rendering techniques were different approximations to the full rendering equation (ray tracing, radiosity, etc.) so we instead estimate the rendering equation statistically using various sampling techniques Led to the development of a host of statistically-based rendering methods
statistical rendering methods attempt to estimate the solution to the Kajiya rendering equation photon mapping, path tracing, Metropolis Light Transport all estimate the complex rendering equation in different ways take CS224 to learn more!
Rendered using MLT, all light comes from the other room
Andries van Dam October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesRendering (9/9)
Side NoteProcedural Shading
Complicated lighting effects can be obtained through use of procedural shading languages
provides nearly infinite lighting possibilities global illumination can be faked with low computational overhead usually requires skilled artist to achieve decent images
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Procedural Shading
A number of advanced rendering techniques are shaders implemented on the GPU in realtime High Dynamic Range Rendering (HDRR) Subsurface Scattering Volumetric Light Shafts Volumetric Soft Shadows Parallax Occlusion Mapping and many more! You will implement some simple shaders later in the semester
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Subsurface Scattering
Advanced technique for rendering translucent materials (skin, wax, milk, etc) light enters material, bounces around, some exits with new properties hold your hand up to a light, youll notice a reddish glow
http://graphics.ucsd.edu/~henrik/
No SSS Whole
www.nvidia.com http://graphics.ucsd.edu/~henrik/
http://www.crytek.com/
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Godrays
Volumetric light shafts are produced by interactions between sunlight and the atmosphere
Can be faked on GPU as translucent volumes
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Image-Based Rendering
A Different Approach:
Image-based rendering (IBR) Instead of spending time and money modeling every object in a complex scene, take photos of it. Youll capture both perfectly accurate geometry and lighting with very little overhead Remember Photosynth? Dilemma: how to generate views other than the one photo you took Part of new area of Computational Photography
The Hacked
QuickTimeVR
Stitch together multiple photos taken from the same location at different orientations. Produces cylindrical or spherical map which allows generation of arbitrarily oriented views from that one position. generating multiple views: discontinuously jump from one precomputed viewpoint to the next. In other words, cant reconstruct missing (obscured) information
Andries van Dam October 21, 2008
Brown
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
They were wrong. Long, slow process to learn what makes animations look acceptable
Problem: reappearance of spatial aliasing Individual stills may contain aliasing artifacts that arent immediately apparent or irritating
impulse may be to ignore them
Sequential stills may differ only slightly in camera or object position. However, these slight changes are often enough to displace aliasing artifacts by a distance of a pixel or two between frames
Moving or flashing pixel artifacts are alarmingly noticeable in animations. Called the crawlies. Edges and lines may ripple, but texture-mapped regions will scintillate like a tin-foil blizzard How to fix crawlies: use traditional filtering to get rid of spatial artifacts in individual stills
October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Temporal Aliasing
(2/3)
Moir pattern
aliased
antialiased
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Quickly moving objects seem to jump around if sampled too infrequently Solution: motion blur. Turns out cameras capture images over a relatively short interval of time (function of shutter speed). For slow moving objects, the shutter interval is sufficiently fast to freeze the motion, but for quickly moving objects, the interval is long enough to smear object across film. This is, in effect, filtering the image over time instead of space Motion blur a very important cue to the eye for maintaining illusion of continuous motion We can simulate motion blur in rendering by taking weighted average of series of samples over small time increments
October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesBehavior (1/4)
Modeling the way the world moves
Cannot underestimate the importance of behavioral realism
we are very distracted by unrealistic behavior even if the rendering is realistic good behavior is very convincing even when the rendering is unrealistic (e.g., motion capture data animating a stick figure still looks very real) most sensitive to human behavior easier to get away with faking ants, toys, monsters, fish etc.
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesBehavior (2/4)
The Best
usually better than keyframe animations and useful for a variety of characters with similar joint structure (e.g., Brown Chad Jenkins, Michael Black) motion synthesis: a recent hot topic how to make new animations out of the motion capture data that you have.
Andries van Dam October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesBehavior (3/4)
The Best (cont.) Physics simulations
kinematics for rigid-body motion, dynamics for F = ma
expensive, using space-time constraints, inverse kinematics, Euler and Runge-Kutta integration of forces, N2-body problems. These can take a long time to solve
fluid dynamics
http://physbam.stanford.edu/~fedkiw/
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
TechniquesBehavior (4/4)
The Gracefully Degraded Break laws of physics (hopefully imperceptibly)
Simplify numerical simulation: consider fewer forces, use bounding boxes instead of precise collision detection, etc. Decrease number of time steps used for Euler integration
Bounding Box
Andries van Dam October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Frame rate equals number of distinct images (frames) per second Good: frame rate is as close to refresh rate as possible Best: frame rate is close to constant
humans perceive changes in frame rate (jerkiness) fundamental precept of real-time: guarantee exactly how long each frame will take polygonal scan conversion: close to constant, but not boundable, time raytracing: boundable time, but image quality varies wildly October 21, 2008 Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
What can you get done in 16.7ms? Do some work on host (pre-drawing) Best: multiprocessor host and graphics cards
accept and integrate inputs throughout frame (1 CPU) update database (1+CPUs)
swap in upcoming geometry and texture respond to last rendering time (adjust level of detail) test for intersections and respond when they occur update view parameters and viewing transform
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
stereo rendering (double frame rate) We rarely have the patience for last years special effects, much less the last decades The quality of realism increases with every new technique invented Tron - a convincing virtual reality? Lord of the Rings looks realistic now, but for how long? What will realism look like next year?
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Non-Photorealistic Rendering
One last digression Artistic renderingtrying to evoke handdrawn or hand-painted styles, such as charcoal sketching, pen and ink illustration, or oil painting For certain applications, elision of some details and exaggeration of others can be helpful (mechanical illustration, scientific visualization, etc.) Non-realism is also used in behavior (cartoon physics), interaction (paintbrushes, virtual tricorder and other virtual widgets in IVR), geometry (Monsters, Inc.) Examples of non-realism:
Finding Nemo some research has investigated cartoon physics and other kinds of exaggerated motion and behavior
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Non-Photorealistic rendering
Examples Cartoon Shading youll be doing this in modeler!
WYSIWYG NPR Draw strokes right onto 3d models, paper by Spike and other Brownies!
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48
INTRODUCTION
TO
COMPUTER
GRAPHIC S
Realism #/48