real-time 3d graphics - virginia techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · graphics...
TRANSCRIPT
![Page 1: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/1.jpg)
1
Real-time 3D Graphics
Doug A. Bowman
![Page 2: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/2.jpg)
2
(C) 2008 Doug Bowman, Virginia Tech 2
Outline
(Very) brief review of 3D image synthesis
Real-time 3D graphics for VEs
![Page 3: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/3.jpg)
3
(C) 2008 Doug Bowman, Virginia Tech 3
Rendering 3D scenes
Most 3D graphics is based on scenescomposed of objects built of polygons.
Goal: from scene specification and viewingspecification, produce a 2D image of thescene with proper 3D perspective bydetermining the color for each pixel on thedisplay
3D teapot animation…
![Page 4: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/4.jpg)
4
(C) 2008 Doug Bowman, Virginia Tech 4
Overview of 3D image synthesis(rendering)
3D model
2D projection
Pixel values
Displayed image
Includes scene definition, camera properties,lighting characteristics, etc.
projection
rasterization
display
Process of mapping the desired 3D primitivesinto a 2D space
2D versions of 3D primitives
Process of changing primitive definitions intopixel locations/colors
Color value for each pixel on the screen, storedin the frame buffer
Process of taking information from framebuffer and producing physical representationon a display device
![Page 5: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/5.jpg)
5
(C) 2008 Doug Bowman, Virginia Tech 5
3D Viewing Example
XZ
Y
Object model
X
Y
Z
![Page 6: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/6.jpg)
6
(C) 2008 Doug Bowman, Virginia Tech 6
Coordinate systems
Right- vs. left-handed World vs. object (object
trees, scenegraphs) World vs. camera Screen/display
Transformations (mappings)between CSs
Right-handedCS
X
Y
Z
![Page 7: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/7.jpg)
7
(C) 2008 Doug Bowman, Virginia Tech 7
Graphics pipeline
Object definition
Compose scene
Define view parameters
Perform culling
Clip to 3D view
volume
Hidden surface removal
Rasterization
Shading
Local space
3D screen space
View space
World space
Display space
Modeling transformation
Viewing transformation
Perspectiveprojection
![Page 8: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/8.jpg)
8
(C) 2008 Doug Bowman, Virginia Tech 8
Modeling transformation
For each vertex:transform object toworld coords.
Each M represents atransformation matrix.
Where is chair2relative to room?
room
table rug
chair1 chair2
M1 M2
M4M3
M0
![Page 9: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/9.jpg)
9
(C) 2008 Doug Bowman, Virginia Tech 9
Graphics pipeline
Object definition
Compose scene
Define view parameters
Perform culling
Clip to 3D view
volume
Hidden surface removal
Rasterization
Shading
Local space
3D screen space
View space
World space
Display space
Modeling transformation
Viewing transformation
Perspectiveprojection
![Page 10: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/10.jpg)
10
(C) 2008 Doug Bowman, Virginia Tech 10
Viewing transformation
Transform world to camera coords. Where are the objects with respect to the camera?
Viewing transformation animation…
View frustum
![Page 11: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/11.jpg)
11
(C) 2008 Doug Bowman, Virginia Tech 11
Clipping
Process of removing polygons and parts ofpolygons that fall outside the view frustum
Basically, comparing each vertex withplane equations for the six view frustumsides
![Page 12: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/12.jpg)
12
(C) 2008 Doug Bowman, Virginia Tech 12
Projections
Projection: mapping 3D to 2D spaceCenter of projection = camera = eyeProjection plane = viewplane: 2D plane
onto which objects are projected
Perspective projection
![Page 13: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/13.jpg)
13
(C) 2008 Doug Bowman, Virginia Tech 13
Mathematics of a one-pointprojection
xprojected = dx/z= x/(z/d)
yprojected = dy/z= y/(z/d)
d
P(x, y, z)
Projection animation…
![Page 14: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/14.jpg)
14
(C) 2008 Doug Bowman, Virginia Tech 14
Graphics pipeline
Object definition
Compose scene
Define view parameters
Perform culling
Clip to 3D view
volume
Hidden surface removal
Rasterization
Shading
Local space
3D screen space
View space
World space
Display space
Modeling transformation
Viewing transformation
Perspectiveprojection
![Page 15: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/15.jpg)
15
(C) 2008 Doug Bowman, Virginia Tech 15
Hidden-surface elimination
Problem: we only need to displaypolygons that are visible
Example approaches:z-buffer (hardware)BSP treeSpatial subdivision
![Page 16: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/16.jpg)
16
(C) 2008 Doug Bowman, Virginia Tech 16
Shading
We can increase realism by adding shading/lighting, butmore complex approaches take longer to calculate
constant flat Gouraud
![Page 17: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/17.jpg)
17
(C) 2008 Doug Bowman, Virginia Tech 17
Rasterization
Once vertices have been projected, we onlyneed to “fill in” the primitives between thevertices
Rasterization (sometimes called scanconversion) is the process of determining whichpixels are part of a primitive and “turning on”those pixels.
Polygon fill animation…
![Page 18: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/18.jpg)
18
(C) 2008 Doug Bowman, Virginia Tech 18
Graphics pipeline
Object definition
Compose scene
Define view parameters
Perform culling
Clip to 3D view
volume
Hidden surface removal
Rasterization
Shading
Local space
3D screen space
View space
World space
Display space
Modeling transformation
Viewing transformation
Perspectiveprojection
![Page 19: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/19.jpg)
19
(C) 2008 Doug Bowman, Virginia Tech 19
What is real time?
“Fast enough” that the user canPerceive smooth motionInteract with the environment
Often stated in frames per second (fps) –number of views of the scene rendered inone second
A frame rate of approx. 10-30 fps is theminimum for “real-time”
![Page 20: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/20.jpg)
20
(C) 2008 Doug Bowman, Virginia Tech 20
Speed vs. Quality tradeoff
More complex models ⇒ slower renderingWe must manage this tradeoff to achieve
maximum quality with an acceptable framerate
![Page 21: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/21.jpg)
21
(C) 2008 Doug Bowman, Virginia Tech 21
Techniques for real-time 3D graphics
Polygonal simplificationView cullingOcclusion cullingLevel of detail managementTexture substitutionLightmaps
![Page 22: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/22.jpg)
22
(C) 2008 Doug Bowman, Virginia Tech 22
Polygonal simplification
Decrease the number of polygons without sacrificingvisual quality (meet polygon budget)
30944 triangles 2502 triangles 621 triangles 251 triangles
![Page 23: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/23.jpg)
23
(C) 2008 Doug Bowman, Virginia Tech 23
Level of detail management
LOD: change the complexityof the model/imagedynamically to maintain real-time performance
Ex: use simplified modelswhen objects are at a greatdistance
![Page 24: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/24.jpg)
24
(C) 2008 Doug Bowman, Virginia Tech 24
Level of detail - another example
Matchcharacteristics ofhuman eye
Use high detail infovea, low detail inperiphery
![Page 25: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/25.jpg)
25
(C) 2008 Doug Bowman, Virginia Tech 25
![Page 26: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/26.jpg)
26
(C) 2008 Doug Bowman, Virginia Tech 26
View culling
Not the same as clipping!
Easy: remove all objects that are behindthe plane of the camera
Harder: remove all objects outside theview frustum
![Page 27: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/27.jpg)
27
(C) 2008 Doug Bowman, Virginia Tech 27
Occlusion culling
Hidden-surface elimination techniques: stillrender all polygons (e.g. z-buffer)
Occlusion culling: remove polygons fromconsideration before rendering
![Page 28: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/28.jpg)
28
(C) 2008 Doug Bowman, Virginia Tech 28
Texture substitution (imposters)
Textures cancause objects toappear muchmore detailedthan they actuallyare
Problem: whenthe user is close
![Page 29: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/29.jpg)
29
(C) 2008 Doug Bowman, Virginia Tech 29
Lightmaps
Pre-calculate lighting for a scene, thentexture lighting onto objects
![Page 30: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/30.jpg)
30
(C) 2008 Doug Bowman, Virginia Tech 30
Lightmapped VEs
![Page 31: Real-time 3D Graphics - Virginia Techcourses.cs.vt.edu/cs5754/lectures/rtgraphics.pdf · Graphics pipeline Object definition Compose scene Define view parameters Perform culling Clip](https://reader034.vdocuments.net/reader034/viewer/2022051407/5fec8008d2b8290e4841f7ce/html5/thumbnails/31.jpg)
31
(C) 2008 Doug Bowman, Virginia Tech 31
Other graphics issues for VEs
Stereo renderingOff-axis projections Inserting the user into the scenegraphParallel / distributed rendering