Lecture 1
Lecture 1
COMPUTER GRAPHICS
Lecture 1: Introduction to Computer Graphics
• Credit: 3
• Prerequisites: C++, Linear Algebra
• Moodle page:
https://moodle.usth.edu.vn/enrol/index.php?id=488
• Materials
• Assignment submissions
• Grading
• Attendance: 10%
• Middle term test: 40%
• Final test: 50%
• Rewards (+2, +1), Penalties (-2, - 1)
2
Textbooks
• Prescribed:
• JungHyun Han. 3D Graphics for Game Programming (1st ed.).
Chapman & Hall/CRC 2011.
• Recommended:
• Hughes, J.F. and van Dam, A. and Foley, J.D. and Feiner, S.K.
Computer Graphics: Principles and Practice (3rd Edition), Addison-
Wesley, 2014, ISBN: 9780321399526.
• Donald D. Hearn and M. Pauline Baker. Computer Graphics with
OpenGL (4th Edition). 2010. Prentice Hall Professional Technical
Reference.
3
Agenda
4
Computer Graphics Overview
Reference: Computer Graphics: Principles and Practice (3rd Edition, 2014)
What is Computer Graphics?
6
Computer Graphics is everywhere
7
Games
8 8
CAD/CAM
• Virtual prototypes
9
Architecture
10
Movie industry
11
Scientific Visualization and Analysis
ApoA1 ©University of Illinois at Urbana-Champaign, Theoretical Biophysics Group
12
Scientific Visualization and Analysis
• Data Visualization
• Scientific, Engineering,
Medical data
• Visualizing millions to
billions of data points
• See trends
• Different schemes
13
Medical images rendering
14
Medicine and Virtual Surgery
15
Why Computer Graphics is fun?
• Inter-discipline:
• Within computer science: systems, hardware, compilers,
algorithms, numerical methods, image processing, computer
vision.
• Outside computer science: math, physics, art, architecture…
• You can see the results, create your own “virtual” world
16
Course objectives
• Theory
• Understand mathematical aspects and algorithms underlying 3D
graphics systems
• Practice
• Write 3D graphics programs
→ Prepare the foundation for
• Game programming
• AR/VR, metaverse
17
What to learn?
• Graphics pipeline
• Fundamentals of CG algorithms
• Concentrate on 3D, not 2D illustration
• Basic OpenGL, Web 3D
18
What NOT to learn?
• Image processing
• Game design
• Artistic skills
• Software packages
• Photoshop
• CAD, CAM
• Maya…
19
History
20
first CAD system (IBM 1959) SketchPad: first interactive graphics (1963)
History
21
Rendering: 1960s (visibility)
22
Rendering: 1970s (lighting)
23
Rendering (1980s, 90s: Global Illumination)
24
2010s: realistic images
25
Graphics pipeline & Model Creation
Reference: Chapter 1 3D graphics for Game Programming
Graphics pipeline
27
Modeling
texture image
29
Animation (cont’)
30
Rendering
31
Rendering
32
3D model: polygon mesh
33
Polygon Mesh (cont’)
refinement
simplification
• Tradeoff between accuracy and efficiency: As the
resolution is increased, the mesh becomes closer to the
original curved surface, but the time needed for processing
the mesh is increased.
35
Polygon Mesh Creation
36
Polygon Mesh Creation (cont’)
37 1-37
Polygon Mesh Creation (cont’)
38 1-38
Polygon Mesh Creation (cont’)
39 1-39
Polygon Mesh: Non-indexed
Triangle List
▪ Non-indexed triangle list
▪ The vertices are enumerated in a memory space, named vertex
buffer.
▪ Three vertices are read in linear order to make up a triangle.
40
Polygon Mesh: Indexed Triangle List
▪ The vertex data stored in the vertex buffer include not only positions
but also normals, texture coordinates, and many more. Therefore, the
vertex buffer storage saved by removing the duplicate data outweighs
the additional storage needed for the index buffer.
41
Surface Normal
▪ When v1 and v2 are represented in (x1 y1 z1) and (x2 y2 z2), respectively,
v1×v2 is defined as (y1z2-z1y2 z1x2-x1z2 x1y2-y1x2).
▪ Every normal vector is made to be a unit vector by default.
▪ Note that p1, p2, and p3 are ordered counter-clockwise (CCW).
42
Surface Normal (cont’)
43
Surface Normal (cont’)
▪ The vector connecting the first vertex (p1) and the second (p3)
and that connecting the first vertex (p1) and the third (p2) define
the triangle normal.
45
Coordinate System’s Handedness
and Vertex Ordering
▪ Right-hand system vs. left-hand system
46
Conversion between RHS and LHS
47
Conversion between RHS and LHS
(cont’)
▪ Problem: flipped image could be negated
48
Conversion between RHS and LHS
(cont’)
▪ Porting an application between RHS and LHS needs two tasks.
▪ The order of triangle vertices has to be changed: p1, p2, p3 → p1, p3, p2
▪ The z-coordinates (objects and view parameters) are negated.
49
Exercise
Consider a tetrahedron
composed of four vertices,
(0,0,0), (1,0,0), (0,1,0), (0,0,1).
• (a) tetrahedron is exported to
a right-hand system, draw the
vertex and index buffers for
its indexed triangle list.
• (b) Assuming that the
tetrahedron is exported to a
left-hand system,
do the same.
50