3D Computer
3D Computer
Graphics in a
Graphics in a
Nutshell
Nutshell
Guillaume Caumon, January
Guillaume Caumon, January
Introduction
Introduction
Computer graphics is concerned
Computer graphics is concerned
with all the aspects of “drawing” on
with all the aspects of “drawing” on
computers
computers
Performance is critical
Performance is critical
3D Computer Graphics deals with
3D Computer Graphics deals with
the generation images from 3D
the generation images from 3D
The Rendering Pipeline
The Rendering Pipeline
Application
Application
Geometry
Geometry
Rasterization
Rasterization
Pipeline = Linear succession of operations
Pipeline = Linear succession of operations
Rendering speed = speed of the slowest step (bottleneck)
Application
Application
Software-based processing / modifications Software-based processing / modifications
3D Model
3D Model Rendering Rendering
primitives primitives meshing
meshing
decimation decimation
animation animation
collision detection collision detection
Geometry
Geometry
Transforms
Geometry : Transforms
Geometry : Transforms
Model Coordinates
Model Coordinates World CoordinatesWorld Coordinates Model Transform
Model Transform Scaling, etc.
Scaling, etc.
View Transform
View Transform
Geometry: lighting and
Geometry: lighting and
shading
shading
Simulate interaction of light with matter: Simulate interaction of light with matter:
- Emission - Emission
- Absorption - Absorption
Geometry: A Lightning
Geometry: A Lightning
Equation
Equation
N N L L α α ββ II
R R(())
ν
ν : r, g or b : r, g or b
Ambient light coefficient Ambient light coefficient
Ex: (.1, .1, .1)
Ex: (.1, .1, .1) Material color Material color
Ex: (1, 0, 0) Ex: (1, 0, 0)
Shininess (s > 1) Shininess (s > 1) Specular Coeficient Specular Coeficient
Geometry: Shading
Geometry: Shading
Flat shading
Flat shading: each triangle has : each triangle has the same color
the same color
Gouraud shading
Gouraud shading: colors are : colors are interpolated between vertices interpolated between vertices
Phong shading
Phong shading: normal are : normal are
interpolated and colors computed interpolated and colors computed for each pixel
Geometry: Projection
Geometry: Projection
Virtual Device Coordinates Virtual Device Coordinates Viewing Coordinates
Viewing Coordinatesnormalizationnormalization Perspective/
Perspective/
parallel
Geometry: Device
Geometry: Device
Coordinates
Coordinates
My Window
My Window
Rasterization
Rasterization
Per-pixel operations: ray-tracing
Per-pixel operations: ray-tracing Screen = matrixScreen = matrix
Texturing Texturing Aliasing / antialiasing Aliasing / antialiasing
Scan conversion of lines: Scan conversion of lines:
naive version naive version
Bresenham algorithm Bresenham algorithm
Graphics Hardware
Graphics Hardware
Quickly evolving Quickly evolving
Main principle: use of
Main principle: use of buffersbuffers
Color buffer :
Color buffer :
1 byte per pixel (256) + lookup tables 1 byte per pixel (256) + lookup tables 2 bytes per pixel (65 536) “high color” 2 bytes per pixel (65 536) “high color”
3+1 bytes per pixel bpp (16 millions) “true color” + alpha channel 3+1 bytes per pixel bpp (16 millions) “true color” + alpha channel
Depth buffer :
Depth buffer :
Graphics Hardware (II)
Graphics Hardware (II)
Double buffering :
Double buffering :
• show the front buffer while rasterizing the show the front buffer while rasterizing the back buffer
back buffer
• swap buffers in synchronization with the swap buffers in synchronization with the screen refresh
screen refresh
to get the new frame to get the new frame Stencil buffer :
Stencil buffer :
allows high-level operations (antialiasing, filtering, etc.) allows high-level operations (antialiasing, filtering, etc.)
Conclusion
Conclusion
3D Graphics require intensive computations 3D Graphics require intensive computations
Yet, 3D Graphics are time-critical Yet, 3D Graphics are time-critical
Bottlenecks Bottlenecks Display lists Display lists
Only low-level graphics have been described. Only low-level graphics have been described.
Scene Graphs Scene Graphs Selection and Selection and
tools
tools
}
}
References and further
References and further
reading
reading
Foley, van Dam, Feiner, Hughes,Foley, van Dam, Feiner, Hughes, Computer Graphics Computer Graphics
Principle and practice,
Principle and practice, 22ndnd edition edition. Addisson Wesley, 1997. Addisson Wesley, 1997
Moller, Haines,Moller, Haines, Real-Time Rendering. Real-Time Rendering. AK Peters, 1999 ( AK Peters, 1999 ( http://www.realtimerendering.com
http://www.realtimerendering.com))
The The Graphic GemsGraphic Gems series, Academic Press. series, Academic Press.
Neider, Davis, Woo, Neider, Davis, Woo, OpenGL Programming GuideOpenGL Programming Guide. . Addisson Wesley, 1993
Addisson Wesley, 1993
Wernecke, Wernecke, The Inventor Mentor, release 2, The Inventor Mentor, release 2, Addisson Addisson Wesley,1994
Wesley,1994
Schroeder, Martin, Lorensen, Schroeder, Martin, Lorensen, The Visualization Toolkit, The Visualization Toolkit,
2
2ndnd edition. edition. Prenctice Hall, 1998Prenctice Hall, 1998
Proceedings of Siggraph, Visualization, Eurographics, Proceedings of Siggraph, Visualization, Eurographics, etc.