Download 01_Introduction.pdf

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

System of linear equations wikipedia , lookup

Matrix multiplication wikipedia , lookup

Singular-value decomposition wikipedia , lookup

Bivector wikipedia , lookup

Laplace–Runge–Lenz vector wikipedia , lookup

Exterior algebra wikipedia , lookup

Matrix calculus wikipedia , lookup

Vector space wikipedia , lookup

Cross product wikipedia , lookup

Euclidean vector wikipedia , lookup

Geometric algebra wikipedia , lookup

Four-vector wikipedia , lookup

Covariance and contravariance of vectors wikipedia , lookup

Transcript
Course staff
Instructor
• Matthias Zwicker
Computergrafik
• Professor at IAM since fall 2008
Teaching Assistant
• Thomas Buchberger
Matthias Zwicker
Universität Bern
Herbst 2008
• Longtime PhD student in the computer
graphics group
Today
Today
• Course organization
• Course organization
• Course overview
• Course overview
• Vectors and coordinate systems
• Vectors and coordinate systems
Course organization
Course organization
Instructor
Lecture
• Matthias Zwicker (zwicker@iam.unibe.ch)
• Fridays, 14:00-16:00, Engehaldenstr. 8,
Hörsaal 001,
Teaching Assistant
• Thomas Buchberger
(buchberg@iam.unibe.ch)
Exercises
• Fridays, 16:00-17:00 , Engehaldenstr. 8,
Hörsaal 001,
1
Class web page
Web-based forum
• Schedule, slides, reading, project
descriptions, etc.
• On ILIAS
http://cgg.unibe.ch/teaching/lectures/hs08/computergrafik/
https://ilias.unibe.ch/ilias3/goto.php?target=cat_7375&client_id=ilias3_unibe
• Use your campus account to log in
• Join group “IAM Computergrafik” with
password “iamcg”
iamcg
Textbooks
Exercises
• Fundamentals of Computer
Graphics, Peter Shirley,
2nd edition (recommended)
• Six programming projects
• OpenGL Programming Guide,
Shreiner Woo,
Shreiner,
Woo Neider,
Neider Davis,
Davis
5th edition (recommended)
• Two exercise series on paper
• Successful completion of exercises is
requirement for exam
– E
Each
h assignment
i
t iis worth
th 10 points
i t
– Total 80 points
– Requirement is 75% (60 points)
• Late penalty
– 50% of original score
– Exceptions for military service, illness
Programming Projects
Programming Projects
• Assignments and schedule on class
webpage
Build your own 3D rendering engine
• Java base code and documentation on
class webpage
• Use ExWi pool or your own computer
• Turn-in by demonstration to TA in ExWi
pool
– Thursdays 12:00-16:00
• Project 1: Matrices, Vectors, and
Coordinate Transformations
• Project 2: Interactive Viewing
• Project
P j
3:
3 Rasterization
R
i i
• Project 4: Lighting and Texturing
• Project 5: Scene Graphs
• Project 6: Shader Programming
2
Exercises on paper
Prerequisites
• Two exercise series on paper
Basic familiarity with
• Schedule TBA
• Linear algebra
• As preparation for exam
• Java
• Object oriented programming
Questions?
Today
• Course organization
• Course overview
• Vectors and coordinate systems
Computer graphics
Computer graphics
Core areas
• Rendering
• Modeling
• Animation
3
Rendering
Photorealistic rendering
• Synthesis of 2D image from 3D scene
description
• Physically-based simulation of light,
camera
– Rendering algorithms interpret data structures
that represent scenes using geometric
primitives, material properties, and lights
• 2D image is an array
arra of pixels
pi els
– Red, green, blue values for each pixel
• Different objectives
– Photorealistic
– Interactive
– Artistic
Photorealistic rendering
• Shadows, realistic illumination, multiple
light bounces
• Slow, minutes to hours per image
• Special effects, movies
• Not in this class
Interactive rendering
• Focus of this class
• Produce images within milliseconds
• Using specialized hardware, graphics
processing units (GPUs)
• Standardized
S d di d AP
APIs (O
(OpenGL,
G Di
DirectX))
• Often “as photorealistic as possible”
• Hard shadows, fake soft shadows, only
single bounce of light
• Games
Interactive rendering
Artistic rendering
• Stylized
• Artwork, illustrations, data visualization
4
Artistic rendering
Modeling
• Creating 3D geometric data
– The “model” or the “scene”
• By hand
– Autodesk (Maya, AutoCAD), LightWave 3D, …
• Free software
– Blender
• Not as easy to
use as Notepad…
Maya Screenshot
Modeling
Modeling
• Basic 3D models consist of array of
triangles
• Procedurally, i.e. by writing programs
• Scanning real-world objects
• Each triangle stores 3 vertices
• Each vertex contains
– xyz position
– Color
– Etc.
Modeling
Animation
Procedural tree
Scanned statue
• Deforming or editing the data
• Change over time
• Faces, articulated characters, …
Procedural city
5
Animation
Physics simulation
http://www.youtube.com/watch?v=Y1LN97l30-k
In this class
http://www.youtube.com/watch?v=_FIKonHQF8Y
Questions?
The Basics…
• Rendering 3D models
– Camera simulation
– Interactive viewing
– Lighting, shading
• Modeling
M d li g
– Triangle meshes
– Smooth surfaces
• Experience with linear algebra, Java, OpenGL
• Background for advanced topics
Today
Vectors and coordinate systems
• Course organization
Why all these mathematics?
• Course overview
• Need to describe 3D scenes
• Vectors and coordinate systems
– Position, orientation, motion of objects
– Relation of objects to virtual camera
– Projection of scene onto image plane
• Linear algebra provides mathematical tools
– Vectors, coordinate systems (bases), matrices,
etc.
– As little abstract theory as possible in this
class
6
Topics today
Vectors
• Vectors
• Direction and length in 3D
• Linear combination, linear dependency
• Coordinate systems
• Dot product, cross product
– No anchor point
• Vectors can describe
– Difference between two 3D points
– Speed of an object
• Representation of planes using vectors
• Vectors are in bold-face
Vectors
Vectors
Multiplication by scalar
Addition
Vectors
Vectors
Addition
Linear combination
7
Vectors
Coordinate systems
Linear combination
• Describe any vector with respect to three
basis vectors
Linearly dependent vectors
• A set of vectors
is linearly
dependent if there exist scalars
such
that
• Otherwise, they are linearly independent
• The basis vectors form a coordinate system
Coordinate systems
Coordinate systems
• Any three vectors that are linearly
independent could be used as a basis
• Any three vectors that are linearly
independent could be used as a basis
– Different lengths
– Not perpendicular to each other
– Different lengths
– Not perpendicular to each other
• Why linearly independent?
• Why exactly three vectors?
• Other coordinate systems?
Coordinate systems
Coordinate Systems
Euclidean coordinate systems
Handedness
• Basis vectors
– Have unit length
– Are perpendicular to each other
• Orthonormal
Right handed
Left handed
8
Vector arithmetic using coordinates
Vector Magnitude
• The magnitude (length) of a vector is:
⎡ ax ⎤
a = ⎢⎢ ay ⎥⎥
⎢⎣ az ⎥⎦
⎡bx ⎤
b = ⎢⎢ by ⎥⎥
⎢⎣ bz ⎥⎦
⎡ ax + bx ⎤
a + b = ⎢⎢ ay + by ⎥⎥
⎣⎢ az + bz ⎦⎥
⎡ ax − bx ⎤
a − b = ⎢⎢ ay − by ⎥⎥
⎣⎢ az − bz ⎦⎥
⎡−ax⎤
−a = ⎢⎢−ay⎥⎥
⎢⎣−az ⎥⎦
⎡sax⎤
sa = ⎢⎢say⎥⎥
⎢⎣saz ⎥⎦
Questions?
v = vx2 + vy2 + vz2
2
v = vx2 + vy2 + vz2
• A vector with length=1
length=1.0
0 is called a unit vector
• We can also normalize a vector to make it a unit
vector
v
v
• Unit vectors are often used as surface normals
Dot product
• Scalar value that tells us something about
the relationship between two vectors
– Product of lengths of vectors and cosine of
angle between vectors
• Definition does not refer to a coordinate
system
– Result is independent of coordinate system
Dot product
Dot Product using coordinates
• If a·b > 0 then θ < 90º
• Result is independent of coordinate
system!
– Vectors point in the same
general direction
• If a·b < 0 then θ > 90º
– V
Vectors
t
point
i t iin opposite
it
direction
• If a·b = 0 then θ = 90º
– Vectors are perpendicular
– (or one or both of the vectors is degenerate
(0,0,0))
a ⋅ b = ∑ ai bi
a ⋅ b = ax bx + ayby + az bz
a ⋅ b = a b cos θ
• What is the meaning of
?
9
Angle between vectors
Dot products with unit vector
• If |u|=1.0 then a·u is the length of the
orthogonal projection of a onto u
a ⋅ b = a b cos θ
⎛ a⋅b ⎞
cosθ = ⎜
⎝ a b ⎟⎠
a
b
⎛ a⋅b ⎞
θ = cos−1 ⎜
⎝ a b ⎟⎠
a
u
a·u
Dot products with unit vectors
Dot products with unit vectors
0 < a·b < 1
a·b = 1
a·b = 1
b
a=b
a·b
a = b = 1.0
a = b = 1.0
a ⋅ b = cos (θ )
a ⋅ b = cos (θ )
Dot products with unit vectors
Dot products with unit vectors
0 < a·b < 1
0 < a·b < 1
a·b = 1
a·b = 0
b
a
a·b = 1
a·b = 0
b
a
-1 < a·b < 0
a·b
a
a·b
a = b = 1.0
a = b = 1.0
a ⋅ b = cos (θ )
a ⋅ b = cos (θ )
10
Dot products with unit vectors
Surface normals
• Vectors are direction and length in 3D
0 < a·b < 1
a·b = 1
a·b = 0
b
-1 < a·b < 0
a
a·b
a·b = -1
• Can describe
– Difference between two 3D points
– Speed of an object
– Surface normals (directions perpendicular to
surfaces)
Normal vector
a = b = 1.0
a ⋅ b = cos (θ )
Surface normals
Representing planes
Cross product
• A plane can be defined by the closest
distance of the plane to the origin and its
normal vector
• Written as a x b
• How can we determine if a point lies on
the plane using the dot product?
Surface
• A vector perpendicular to a and b
– In the direction defined by the right hand rule
– Length is area of parallelogram spanned by a
and
db
• Definition does not refer to coordinate
system!
Cross product
• If vectors a, b are unit length and
perpendicular, then a, b, a x b
is a right handed coordinate system
• a x b = -(b x a)
Cross product
a × b is a vector perpendicular to
both a and b, in the direction
defined by the right hand rule
Vectors
lie in the plane of the
projection screen. Does
point
towards you or away from you? What
about
?
11
Cross product
a × b is a vector perpendicular to
Cross product
• Using coordinates
both a and b, in the direction
defined by the right hand rule
a × b = a b sin
i θ
a × b = area of parallelogram ab
a × b = 0 if a and b are parallel
(or one or both degenerate)
Questions?
Coming up
Exercise session
• Introduction to the Java base code
• Representation of 3D shapes using triangle
meshes
Next class
• Matrices and transformations
12