CSE4030 Introduction to Computer Graphics · 2011-12-28 · See the Difference? Elements of Image...
Transcript of CSE4030 Introduction to Computer Graphics · 2011-12-28 · See the Difference? Elements of Image...
Introduction to Computer Graphics
Dongguk University
Jeong-Mo Hong
CSE4030
Timetable
00:00~00:10 Introduction (English)
00:10~00:50 Topic 1 (English)
00:50~00:60 Q&A (English, Korean)
01:00~01:40 Topic 2 (English)
01:40~01:50 Quiz (English, Korean)
01:50~01:60 Q&A (English, Korean)
Week 2 • Let’s get drawing!
– How does your computer draw?
– A review on 2D graphics
Michelangelo and You
[Koller et al. 2004] [Michelangelo 1504]
Basic Graphics System
Input devices
Output device
Image formed in FB
Raster Graphics
• Image produced as an array (the raster) of picture elements (pixels) in the frame buffer
http://www.youtube.com/watch?v=Jwd5ya56wBI
Depth of Frame Buffer • Depth or precision of the frame buffer
– Determines how many colors can be represented on a give system
– 1-bit-deep frame buffer 2 colors
– 8-bit-deep frame buffer 2^8(256) colors
CPU vs GPU
http://www.youtube.com/watch?v=fKK933KK6Gg (short version) http://www.youtube.com/watch?v=ZrJeYFxpUyQ&annotation_id=annotation_764898&feature=iv (full version)
• NVIDIA – Adam & Jamie draw a MONA LISA in 80 milliseconds!
– Parallel processing on GPU's
Object Seen by Different Viewers
FIGURE 1.6 Image seen by three different viewers. (a) A’s view. (b) B’s view. (c) C’s view.
Image Formation
3D 2D
See the Difference?
Elements of Image Formation
• Objects
• Viewer
• Light source(s)
• Attributes that govern how light interacts with the materials in the scene
• Note the independence of the objects, the viewer, and the light source(s)
Ray Interactions
FIGURE 1.11 Ray interactions. Ray A enters camera directly. Ray B goes off to infinity. Ray C is reflected by a mirror. Ray D goes trough a transparent sphere.
Ray Tracing and Geometric Optics
One way to form an image is to
follow rays of light from a
point source finding which
rays enter the lens of the
camera. However, each
ray of light may have
multiple interactions with objects
before being absorbed or going to infinity.
Three-Color Theory
• Human visual system has two types of sensors
– Rods: monochromatic, night vision
– Cones
• Color sensitive
• Three types of cones
• Only three values (the tristimulus
values) are sent to the brain
• Need only match these three values
– Need only three primary colors
Object
• Where did this image come from?
Wireframe Graphics
wireframe representation of sun object
Raster Graphics
• Allows us to go from lines and wire frame images to filled polygons
Recently
• Realism comes to computer graphics
smooth shading environment mapping
bump mapping
Break and Q&A
CSE4030
The Programmer’s Interface • Programmer sees the graphics system through
a software interface: the Application Programmer Interface (API)
• OpenGL
• Open Graphics Library – API for 2D and 3D graphics programming
– GLUT – The OpenGL Utility Toolkit
First Example
glBegin(GL_POLYGON)
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 1.0, 0.0);
glVertex3f(1.0, 0.0, 0.0);
glEnd( );
type of object
location of vertex
end of object definition
Simplified Pipeline
Geometric Pipeline
• Pipeline architecture
• All steps can be implemented in hardware on the graphics card
application program
display
Vertex Processing • Much of the work in the pipeline is in converting
object representations from one coordinate system to another – Object coordinates
– Camera (eye) coordinates
– Screen coordinates
• Every change of coordinates is equivalent to a matrix transformation
• Vertex processor also computes vertex colors
Projection
• Projection is the process that combines the 3D viewer with the 3D objects to produce the 2D image
– Perspective projections: all projectors meet at the center of projection
– Parallel projection: projectors are parallel, center of projection is replaced by a direction of projection
Clipping
• Just as a real camera cannot “see” the whole world, the virtual camera can only see part of the world or object space – Objects that are not within this volume are said to be
clipped out of the scene
Primitive Assembly
• Vertices must be collected into geometric objects before clipping and rasterization can take place
– Line segments
– Polygons
– Curves and surfaces
Rasterization
• The primitives that emerge from the clipper are still in terms of their vertices
• They must be further processed to generate pixels in the frame buffer
• The output of rasterizer is a set of fragments for each primitive
• Fragments are “potential pixels” – Have a location in frame buffer
– Color and depth attributes
Fragment Processing
• Fragments are processed to determine the color of the corresponding pixel in the frame buffer
• Colors can be determined by texture mapping or interpolation of vertex colors
• Fragments may be blocked by other fragments closer to the camera – Hidden-surface removal
Lab 2
• How to Start Graphics Programming
– GLUT setup
– Visual Studio environment setting
– GLUT API
• Preparing for a canvas (window)
• Input devices (keyboard, mouse)
Reading Assignment
• Appendix B Spaces
• Appendix C Matrices
Quiz
CSE4030