graphics 2014 - utrecht university · announcements practicals this week tuesday (today) tue 9-11...
TRANSCRIPT
![Page 1: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/1.jpg)
Graphics 2014
The Rasterization Pipeline Projection, Visibility,
& Shading
![Page 2: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/2.jpg)
Announcements
Practicals this week
Tuesday (today)
Tue 9-11 (was held)
Tue 13-15 canceled (programming contest)
Wednesday (tomorrow)
Wed 15-17: additional practical slot
We 17-19: additional practical slot
Thursday: no practicals
![Page 3: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/3.jpg)
core topics
important
CORE
Addendum:
Matrix Algebra
![Page 4: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/4.jpg)
Transposition
Matrix Transposition
Swap rows and columns
In other words: Flip around diagonal
Formally: ⋱ ⋅ ⋰⋅ ⋅ ⋅⋅ ⋅⋅ ⋅ ⋅⋰ ⋅ ⋱
T
=⋱ ⋅ ⋅ ⋅ ⋰⋅ ⋅ ⋅ ⋅⋰ ⋅ ⋅ ⋅ ⋱
T
=
𝑎𝑖,𝑗 𝑎𝑗,𝑖
![Page 5: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/5.jpg)
Orthogonal Matrices
Othogonal Matrices
(i.e., column vectors orthonormal) 𝐌𝑇 = 𝐌−1
Proof: next three slides
![Page 6: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/6.jpg)
Matrix Multiplication
General matrix products:
𝐁 ⋅ 𝐀: possible if #Row(𝐀) = #Columns(𝐁)
°
𝐀
𝐁
𝐀 =
𝑎1,1 ⋯ 𝑎1,𝑛⋮ ⋮𝑎𝑚,1 ⋯ 𝑎𝑚,𝑛
𝐁 =
𝑏1,1 ⋯ 𝑏1,𝑚⋮ ⋮𝑏𝑘,1 ⋯ 𝑏𝑘,𝑚
𝑘
𝑚 𝑛
𝑛
𝑚
𝑘
𝐑 =
𝑟1,1 ⋯ 𝑟1,𝑛⋮ ⋮𝑟𝑘,1 ⋯ 𝑟𝑘,𝑛
𝐑 = 𝐁 ⋅ 𝐀
𝑟𝑖,𝑗 = 𝑎𝑞,𝑗 ⋅ 𝑏𝑖,𝑞
𝑚
𝑞=1
![Page 7: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/7.jpg)
Matrix Multiplication
Matrix Multiplication
𝐀 ⋅ 𝐁
=
− 𝐚1 − ⋮ − 𝐚𝑑 −
⋅
| |𝐛1 ⋯ 𝐛𝑑| |
=⋱ ⋰ 𝐚𝑖 , 𝐛𝑗 ⋰ ⋱
Scalar products of rows and columns
![Page 8: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/8.jpg)
Matrix Multiplication
Othogonal matrices:
𝐀T ⋅ 𝐀
=
− 𝐚1 − ⋮ − 𝐚𝑑 −
⋅| |𝐚1 ⋯ 𝐚𝑑| |
=⋱ ⋰ 𝐚𝑖 , 𝐚𝑗 ⋰ ⋱
=1 ⋯ 0⋮ ⋱ ⋮0 ⋯ 1
= 𝐈
𝐚1
𝐚2
![Page 9: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/9.jpg)
Transposition Rules
Transposition
Multiplication: 𝐀 ⋅ 𝐁 T = 𝐁T ⋅ 𝐀T
Inversion: 𝐀 ⋅ 𝐁 −1 = 𝐁−1 ⋅ 𝐀−1
Inverse-transp.: 𝐀T−1= 𝐀−1 T
Othogonality: 𝐀T = 𝐀−1 ⇔ 𝐀 is orthogonal
![Page 10: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/10.jpg)
core topics
important
CORE
Homogeneous Coordinates (short version)
![Page 11: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/11.jpg)
Problem
Translations are not linear
𝐱 → 𝐌𝐱 cannot encode translations
Proof: Origin cannot be moved:
𝐌 ⋅ 𝟎 =
𝑚11 𝑚12 𝑚13𝑚21 𝑚22 𝑚23𝑚31 𝑚32 𝑚33
000=000
![Page 12: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/12.jpg)
Homogeneous Coordinates
Solution: Just add a constant one
Increase dimension ℝ𝑑 → ℝ𝑑+1
Last entry = 1 in vectors
“Cheap Trick”, “Evil Hack”
𝐌′ ⋅ 𝐱 =
𝑚11 𝑚12 𝑚13 𝑡1𝑚21 𝑚22 𝑚23 𝑡2𝑚31 𝑚32 𝑚33 𝑡30 0 0 1
𝑥𝑦𝑧1
=
⋱ ⋰ |
𝐌 𝐭⋰ ⋱ |0 0 0 1
|𝐱|1
=
|𝐌𝐱 + 𝐭|1
![Page 13: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/13.jpg)
Homogeneous Coordinates
General case
𝐌 ⋅ 𝐱 =
𝑚11 𝑚12 𝑚13 𝑚14𝑚21 𝑚22 𝑚23 𝑚24𝑚31 𝑚32 𝑚33 𝑚34𝑚41 𝑚42 𝑚43 𝑚44
𝑥𝑦𝑧1
=
𝑥′𝑦′
𝑧′𝑤′
𝑤′ might be different from 1
Convention: Divide by 𝑤-coord. before using
Result:
𝑥′/𝑤′
𝑦′/𝑤′
𝑧′/𝑤′1
![Page 14: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/14.jpg)
Homogeneous Coordinates
General case
𝐌 ⋅ 𝐱 =
𝑚11 𝑚12 𝑚13 𝑚14𝑚21 𝑚22 𝑚23 𝑚24𝑚31 𝑚32 𝑚33 𝑚34𝑚41 𝑚42 𝑚43 𝑚44
𝑥1𝑥2𝑥31
=
𝑦1𝑦2𝑦3𝑦4
≡
𝑦1/𝑦4𝑦2/𝑦4𝑦3/𝑦41
Can express divisions by common denominator
𝑦4 = 𝑚41𝑥1 +𝑚42𝑥2 +𝑚43𝑥3 +𝑚44𝑥4
Rules:
Before using as 3D point, divide by last (4th) entry
No normalization required during subsequent transformations (matrix-mult.)
![Page 15: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/15.jpg)
The Full Story?
Projective Geometry
Not just an evil hack
Deep & interesting theoretical background
For simplicity
We’ll treat it as a computational trick for now
Focus on the graphics application
Remember for now:
We can build “4D Translation matrices” for 3D+1 points
We can “divide” by a common linear factor
![Page 16: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/16.jpg)
Now for
3D Rendering
![Page 17: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/17.jpg)
basic topics
study completely
BASIC
3D Rendering Overview
![Page 18: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/18.jpg)
3D Computer Graphics
Three main aspects
Modeling
Describe 3D geometry mathematically
– From machine parts (e.g., CAD)
– To natural phenomena (e.g., fractals)
Animation
Set scenes into motion
– Simple: Camera fly-through
– Complex: Fluid simulation, human motion
Rendering
Convert geometry into images
Our Focus right now
![Page 19: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/19.jpg)
3D Rendering
Assumption
3D Model is given
Triangle mesh (for simplicity)
How do we get it to the screen?
![Page 20: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/20.jpg)
Agenda
Upcoming Topics
Modeling: mesh representation
Physics: Perspective projection
Rendering: Two main rendering methods
Rasterization
– Perspective projection
– Rasterization
– Visibility
– Shading
– Programmable shaders / GPUs
Raytracing
![Page 21: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/21.jpg)
Geometric Model
Perspective Visibility Local Illumination
Smooth Shading Simple Shadows Global Illumination
3D Rendering Steps
![Page 22: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/22.jpg)
Perspective Visibility Local Illumination
Smooth Shading Simple Shadows Global Illumination
Geometric Model
3D Rendering Steps
![Page 23: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/23.jpg)
basic topics
study completely
BASIC
Modeling
Mesh Representation
basic topics
study completely
BASIC
basic topics
study completely
BASIC
![Page 24: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/24.jpg)
Modeling Shapes
Primitives
Elementary geometric building blocks
Easy to handle directly
Complex models
Sets of primitives
Approximate shapes with primitives
Most-frequently-used
Triangles!
yep, triangles!
![Page 25: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/25.jpg)
Simple Triangle List
Vertex list Vector3D vertices[n];
(1) 𝐩1 = (𝑥1, 𝑦1, 𝑧1)
(2) 𝐩2 = (𝑥2, 𝑦2, 𝑧2)
(3) 𝐩3 = (𝑥3, 𝑦3, 𝑧3)
(4) 𝐩4 = (𝑥4, 𝑦4, 𝑧4)
⋮
(n) 𝐩n = (𝑥𝑛, 𝑦𝑛, 𝑧𝑛)
Triangle list (int[3]) triangles[m];
(1) 𝐭1 = (𝑖1, 𝑗1, 𝑘1)
(2) 𝐭2 = (𝑖2, 𝑗2, 𝑘2)
(3) 𝐭3 = (𝑖3, 𝑗3, 𝑘3)
⋮
(m) 𝐭m = (𝑖𝑚, 𝑗𝑚, 𝑘𝑚)
![Page 26: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/26.jpg)
Modeling a Triangle
Triangle
Triangles: 𝐱 𝜆, 𝜇 = 𝐩1 + 𝜆𝐭1 + 𝜇𝐭2
= 𝐩1 + 𝜆 𝐩2 − 𝐩1 + 𝜇 𝐩3 − 𝐩1
0 ≤ 𝜆 ≤ 1, 0 ≤ 𝜇 ≤ 1, 𝜇 + 𝜆 ≤ 1
Parametric Plane Equation
(with constraints)
0
𝐩1
t1
t2
𝐩3
𝐩2
![Page 27: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/27.jpg)
Attributes
How to define a triangle?
We need three points in ℝ3
But we can have more:
per-vertex normal
per-vertex color
texture per-vertex texture coordinates
(etc...)
![Page 28: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/28.jpg)
Complete Data Structures
Multiple Arrays: Vertices, Triangles
v1: (posx posy posz), attrib1, ..., attribn ...
vN: (posx posy posz), attrib1, ..., attribn
e1: (index1 index2), attrib1, ..., attribk ...
eK: (index1 index2), attrib1, ..., attribk
t1: (idx1 idx2 idx3), attrib1, ..., attribm ...
tM: (idx1 idx2 idx3), attrib1, ..., attribm
edges: optional
, Edges
![Page 29: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/29.jpg)
Visibility Local Illumination
Smooth Shading Simple Shadows Global Illumination
Geometric Model
3D Rendering Steps
Perspective
![Page 30: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/30.jpg)
core topics
important
CORE
Physics
Ray Optics & Color
![Page 31: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/31.jpg)
Ray Optics
Geometric ray model
Light travels along rays
![Page 32: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/32.jpg)
Ray Optics
Geometric ray model
Rays have “intensity” and “color”
![Page 33: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/33.jpg)
Ray Optics
Color spectrum
Continuous spectrum
Intensity for each wavelength
wavelength 𝜆
390nm 700nm
reddish bluish
gray with a tint of green
![Page 34: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/34.jpg)
Human Vision
Color spectrum
Two types of receptive cells (color/low-light)
Three types of color cells
reddish bluish
greenish
wavelength 𝜆
390nm 700nm
low light (monochrome)
(curves: schematic, not accurate)
![Page 35: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/35.jpg)
RGB Model
Bitmap (Pixel Display)
Screen: 𝑤 ⋅ ℎ discrete pixels
Origin: usually upper left
Varying color per pixel
RGB Model
Every pixel can emit red, green, blue light
Intensity range:
Usually: bytes 0...255
000 = dark
255 = maximum brightness
𝑤
ℎ
x-coord.
y-c
oo
rd.
0 w – 1
h – 1
![Page 36: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/36.jpg)
Human Vision
Create color impressions
Basis for three-dimensional color space
Wide spacing, narrow bands: purer colors
Otherwise: washed out colors
wavelength 𝜆
390nm 700nm
(curves: schematic, not accurate)
Response curves: human eye (ideal) monitor:
emitted spectra
![Page 37: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/37.jpg)
basic topics
study completely
BASIC
Physics
Perspective Projection
![Page 38: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/38.jpg)
Pinhole Camera
Pinhole camera
Create image by selecting rays of specific angles
Low efficiency (small holes for sharp images)
![Page 39: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/39.jpg)
Pinhole Camera
Pinhole camera
Create image by selecting rays of specific angles
Low efficiency (small holes for sharp images)
![Page 40: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/40.jpg)
Pinhole Camera
Central Projection
![Page 41: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/41.jpg)
Pinhole Camera
Central projection
𝑥′ = 𝑓𝑥
𝑧
𝑦′ = 𝑓𝑦
𝑧
𝑦′
𝑦
𝑓 𝑧
Proof: Intercept theorem!
![Page 42: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/42.jpg)
(Actual Camera)
Camera with Lens
Higher efficiency (bundles many rays)
Finite Depth of field
We will consider pinhole cameras only.
![Page 43: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/43.jpg)
Pinhole Camera
𝑦′
𝑦
𝑓 𝑧
Undetermined degree of freedom
Focal length vs. image size
Source of a lot of confusion!
𝑥′ = 𝑓𝑥
𝑧
𝑦′ = 𝑓𝑦
𝑧
![Page 44: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/44.jpg)
Pinhole Camera
Parameters
h - size of the screen (pixels, cm, ±1.0,...)
f – focal length (classical photography)
Meaningful parameter: – viewing angle
h 𝑓
𝛼
𝛼
![Page 45: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/45.jpg)
Pinhole Camera
Relation:
tan𝛼
2=ℎ
2𝑓
h 𝑓
𝛼
![Page 46: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/46.jpg)
Pinhole Camera
Invariance
Scaling h and f by a common factor: no change
h
𝑓′
𝛼
tan𝛼
2=ℎ
2𝑓=ℎ′
2𝑓′=ℎ′′
2𝑓′′
ℎ′ ℎ′′
𝑓 𝑓′′
![Page 47: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/47.jpg)
Pinhole Camera
Typical choices (vertical angles)
“Normal” perspective: 𝛼 ≈ 30° (“50mm” lens: 27°)
Tele photography: 𝛼 ≈ 5° − 20° (275–70mm)
Wide angle lens: 𝛼 ≈ 45° − 90° (28–12mm)
h 𝑓
𝛼
![Page 48: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/48.jpg)
General Camera
Our camera so far:
Focus point: origin
View direction: z-axis
General position/orientation?
𝑦′
𝑦
𝑓 𝑧
𝑥′ = 𝑓𝑥
𝑧
𝑦′ = 𝑓𝑦
𝑧
![Page 49: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/49.jpg)
Homogeneous Coordinates
Write in homogeneous coordinates
Third row is arbitrary (for now), not used.
𝑥′ = 𝑓𝑥
𝑧
𝑦′ = 𝑓𝑦
𝑧
𝑧′ =𝑧 − 1
𝑧
𝑤′ = 𝑧
𝑥′𝑦′
𝑧′𝑤′
=
𝑓 0 0 00 𝑓 0 00 0 1 −10 0 1 0
𝑥𝑦𝑧1
Projection Matrix P
![Page 50: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/50.jpg)
View transform
Reminder:
h 𝛼
tan𝛼
2=ℎ
2𝑓
ℎ′′
𝑓
![Page 51: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/51.jpg)
To Screen Coordinates
Scale to unit screen coordinates
We set 𝑓 to 1 in previous matrix
Third row is arbitrary (for now), not used.
1
tan𝛼2
0 0 0
01
tan𝛼2
0 0
0 0 1 00 0 0 1
+ 1
– 1
+ 1 – 1
0
+ 1 – 1
+ 1
– 1
0
normalized screen coordinates
![Page 52: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/52.jpg)
Aspect Ratio
Non-square screens?
Screen: w× ℎ pixels
Aspect ratio 𝑤
ℎ
Different horizontal angle!
1𝑤ℎ⋅ tan𝛼2
0 0 0
01
tan𝛼2
0 0
0 0 1 00 0 0 1
+ 1 – 1
+ 1
– 1
0
normalized screen coordinates
non-square screen
h – 1
w – 1
![Page 53: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/53.jpg)
To Screen Coordinates
Scale to pixels
Third row is arbitrary (for now), not used.
𝑤/2 0 0 𝑤/20 −ℎ/2 0 ℎ/20 0 1 00 0 0 1
x-coord.
y-c
oo
rd.
0 w – 1
h – 1
0
+ 1
– 1
+ 1 – 1
0 + 1 – 1
+ 1
– 1
0
0
h – 1
w – 1
![Page 54: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/54.jpg)
To Screen Coordinates
Overall
Multiple both
ℎ/2
tan𝛼2
0 0𝑤/2
tan𝛼2
0 −ℎ/2
tan𝛼2
0ℎ/2
tan𝛼2
0 0 1 00 0 1 0
Additionally: Also scale + shift such that
𝑧′ =𝑧 − 1
𝑧
are in value [0..1] for inputs 𝑧 ∈ [𝑧𝑛𝑒𝑎𝑟 , 𝑧𝑓𝑎𝑟]
a b
𝑎 =𝑧𝑓𝑎𝑟 + 𝑧𝑛𝑒𝑎𝑟
𝑧𝑛𝑒𝑎𝑟 − 𝑧𝑓𝑎𝑟
𝑏 = 2 ⋅ 𝑧𝑛𝑒𝑎𝑟 ⋅ 𝑧𝑓𝑎𝑟
𝑧𝑛𝑒𝑎𝑟 − 𝑧𝑓𝑎𝑟
![Page 55: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/55.jpg)
Summary
Projection matrix
𝐏 =
𝑓 0 0 00 𝑓 0 00 0 1 −10 0 1 0
Projection & conversion to screen coords
𝐏𝑠 =
𝑤/2 0 0 𝑤/2
0 −ℎ/2 0 ℎ/2
0 0 1 0
0 0 0 1
1𝑤ℎtan𝛼2
0 0 0
01
tan𝛼2
0 0
0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0
0 0 1 −1
0 0 1 0
projection matrix
normalized screen coord’s
scaling to pixels, upper left origin
(𝑓 = 1)
![Page 56: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/56.jpg)
Alternative (1)
Alternative formulation: Only two steps
𝐏𝑠 =
𝑤/2 0 0 𝑤/2
0 −ℎ/2 0 ℎ/2
0 0 1 0
0 0 0 1
1𝑤ℎtan𝛼2
0 0 0
01
tan𝛼2
0 0
0 0 1 −1
0 0 1 0
Different scale factors (not a focal length)
Use two different scale factors 𝑓𝑥 =1
𝑤
ℎtan𝛼
2
, 𝑓𝑦 =1
tan𝛼
2
projection matrix
normalized screen coord’s
scaling to pixels, upper left origin &
![Page 57: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/57.jpg)
Alternative (2)
Another Alternative Formulation
𝐏𝑠 =
ℎ/2 0 0 𝑤/2
0 −ℎ/2 0 ℎ/2
0 0 1 0
0 0 0 1
1
tan𝛼2
0 0 0
01
tan𝛼2
0 0
0 0 1 −1
0 0 1 0
Constant focal length 𝑓 =1
tan𝛼
2
Intermediate result not normalized to −1,1 2
projection matrix
vertically normalized screen coord’s
scaling to pixels, upper left origin & +
𝑤
ℎ –
𝑤
ℎ
+ 1
– 1
0
![Page 58: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/58.jpg)
Alternatives
All three derivations lead to the same result
Intermediate results not used ⇒ all equivalent
Product of the 2/3 matrices is the same
Intermediate results being used:
Some graphics APIs (e.g., OpenGL) do use normalized device coordinates as intermediate
OpenGL – for pixels to appear on screen:
𝑥′ ∈ [−1,1] 𝑦′ ∈ [−1,1] 𝑧′ ∈ [0,1)
𝑤 ∈ 𝑧𝑛𝑒𝑎𝑟 , 𝑧𝑓𝑎𝑟
coupled, so this is the same criterion
![Page 59: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/59.jpg)
General Camera
general camera
𝐲 𝐱
𝐳
camera in origin, view in z-direction
object of interest
![Page 60: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/60.jpg)
General Camera
general camera
𝐲 𝐱
𝐳
camera in origin, view in z-direction
object of interest
𝐯
𝐮 𝐰
𝐜
![Page 61: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/61.jpg)
General Camera
general camera
𝐲 𝐱
𝐳
camera in origin, view: z-direction
𝐯
𝐮 𝐰
𝐜
Camera coordinate system 𝐮, 𝐯,𝐰 Origin: 𝐜
Standard coordinates 𝐱, 𝐲, 𝐳 =100,010,001
![Page 62: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/62.jpg)
Derivation
𝐲 𝐱
𝐳
𝐲 𝐱
𝐳
𝐯
𝐮 𝐰
𝐜
![Page 63: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/63.jpg)
Derivation
𝐲 𝐱
𝐳
𝐯′
𝐮′ 𝐰′
−𝐜
Same effect: Transform the world with inverse camera transform
| | |
𝐮′ 𝐯′ 𝐰′| | |
=| | |𝐮 𝐯 𝐰| | |
−1
![Page 64: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/64.jpg)
Derivation
𝐲 𝐱
𝐳
𝐯′
𝐮′ 𝐰′
−𝐜
Transform:
𝐩 →| | |𝐮 𝐯 𝐰| | |
−1
𝐩 − 𝐜
| | |
𝐮′ 𝐯′ 𝐰′| | |
=| | |𝐮 𝐯 𝐰| | |
−1
![Page 65: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/65.jpg)
Derivation
𝐲 𝐱
𝐳
−𝐜
Transform:
𝐩 → − 𝐮 −− 𝐯 −− 𝐰 −
𝐩 − 𝐜
𝐮, 𝐯,𝐰 orthogonal!
𝐯′
𝐮′ 𝐰′ | | |𝐮′ 𝐯′ 𝐰′| | |
=| | |𝐮 𝐯 𝐰| | |
−1
![Page 66: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/66.jpg)
General Camera
general camera
𝐲 𝐱
𝐳
camera in origin, view: z-direction
𝐮
𝐫 𝐯
𝐜
Camera coordinate system 𝐮, 𝐫, 𝐯 Origin: 𝐜
Standard coordinates 𝐱, 𝐲, 𝐳 =100,010,001
Transform:
𝐩 → − 𝐮 −− 𝐯 −− 𝐰 −
(𝐩 − 𝐜)
![Page 67: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/67.jpg)
General Camera
general camera
𝐲 𝐱
𝐳
𝐮
𝐫 𝐯
𝐜
Camera coordinate system 𝐮, 𝐫, 𝐯 Origin: 𝐜
Homogeneous:
𝐩 →
− 𝐮 − |
− 𝐯 − −𝐜′
− 𝐰 − |0 0 0 1
𝐩
𝐜′ = − 𝐮 −− 𝐯 −− 𝐰 −
𝐜
![Page 68: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/68.jpg)
Summary
Projection (screen coord’s)
𝐏𝑠 =
ℎ/2 0 0 𝑤/20 −ℎ/2 0 ℎ/20 0 1 00 0 0 1
1
tan𝛼2
0 0 0
01
tan𝛼2
0 0
0 0 1 00 0 0 1
1 0 0 00 1 0 00 0 1 −10 0 1 0
Add View Matrix
𝐏𝑠 ⋅
− 𝐮 − |
− 𝐯 − −𝐜′
− 𝐰 − |0 0 0 1
Benefit:
Still only one overall 4×4 matrix
to multiply with!
(𝑓 = 1)
![Page 69: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/69.jpg)
Local Illumination
Smooth Shading Simple Shadows Global Illumination
3D Rendering Steps
Visibility Perspective
Geometric Model
![Page 70: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/70.jpg)
core topics
important
CORE
basic topics
study completely
BASIC
Visibility Algorithms
![Page 71: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/71.jpg)
Two Rendering Pipelines
Rasterization
Project all triangles to the screen
Rasterize them (convert to pixels)
Determine visibility
Apply shading (compute color)
Raytracing
Iterate over all pixels
Determine visible triangle
Compute shading, color pixel
![Page 72: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/72.jpg)
Triangle / Polygon Rasterization
After Perspective Projection
Observations
Straight lines remain straight!
Triangles mapped to triangles
Polygons to polyogns
![Page 73: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/73.jpg)
Rasterization
3D Scene
Projection Visibility Rasterization
Visiblity
• preprocessing
or
• during rasterization
![Page 74: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/74.jpg)
Raytracing
3D Scene
![Page 75: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/75.jpg)
Comparison
Rasterization
FOR (each triangle) {
compute pixels covered (“fragments”)
FOR (all fragments) {
fragment visible?
IF (visible) {
shade fragment
write color
}
}
}
Raytracing
FOR (each pixel) {
compute visible triangle
IF (found) {
shade fragment
write color
}
}
![Page 76: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/76.jpg)
Rasterization
Focus for now:
Rasterization (Raytracing covered later)
Two main algorithms
Painter’s algorithm (old)
Simple version
Correct version
z-Buffer algorithm
Dominant real-time method today
![Page 77: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/77.jpg)
core topics
important
CORE
Painter’s Algorithm
![Page 78: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/78.jpg)
Painter’s Algorithm
Painters Algorithm
Sort primitives back-to-front
Draw with overwrite
Drawbacks
Slowish
𝒪(𝑛 ⋅ log 𝑛) for 𝑛 primitives
“Millions per second”
Wrong
Not guaranteed to always work
![Page 79: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/79.jpg)
Counter Example
Correct Algorithm
Need to cut primitives
Several strategies
Notable: BSP Algorithm in Quake
Old graphics textbooks list many variants
No need for us to go deeper
![Page 80: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/80.jpg)
basic topics
study completely
BASIC
z-Buffer Algorithm
![Page 81: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/81.jpg)
z-Buffer Algorithm
Algorithm
Store depth value for each pixel
Initialize to MAX_FLOAT
Rasterize all primitives
Compute fragment depth & color
Do not overwrite if fragment is farer away than the one stored the one in the buffer
color depth
![Page 82: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/82.jpg)
Discussion: z-Buffer
Advantages
Extremely simple
Versatile – only primitive rasterization required
Very fast
GeForce 2 Ultra: 2GPixel /sec (release year: 2000)
GeForce 700 GTX Titan: 35 GPixel / sec (release year: 2013)
![Page 83: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/83.jpg)
Discussion: z-Buffer
Disadvantages
Extra memory required
This was a serious in obstacle back then...
Invented 39 years ago (1974; Catmull / Straßer)
Only pixel resolution
Need painter’s algorithm for certain vector graphics computations
No transparency
This is a real problem for 3D games / interactive media
Often fall-back to sorting
Solution: A-Buffer, but no hardware support
![Page 84: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/84.jpg)
Smooth Shading Simple Shadows Global Illumination
3D Rendering Steps
Visibility Perspective
Geometric Model
Local Illumination
![Page 85: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/85.jpg)
core topics
important
CORE
Shading Models
![Page 86: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/86.jpg)
mirror
diffuse surface
Reflectance Models
glossy surface
![Page 87: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/87.jpg)
Interaction with Surfaces
Local Shading Model
Single point light source
Shading model / material model
Input: light vector 𝐥 = 𝐩𝐨𝐬𝑙𝑖𝑔ℎ𝑡 − 𝐩𝐨𝐬𝑜𝑏𝑗𝑒𝑐𝑡
Input: view vector 𝐯 = 𝐩𝐨𝐬𝑐𝑎𝑚𝑒𝑟𝑎 − 𝐩𝐨𝐬𝑜𝑏𝑗𝑒𝑐𝑡
Input: surface normal 𝐧 (orthogonal to surface)
Output: color (RGB)
Viewer
Light
object surface
𝐯 𝐥 𝐧
Formalization: BRDF
![Page 88: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/88.jpg)
Interaction with Surfaces
General scenario
Multiple light sources?
Light is linear
Multiple light sources: add up contributions
Double light strength ⇒ double light output
Formalization: BRDF
Viewer
Light
object surface
𝐯 𝐥 𝐧
![Page 89: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/89.jpg)
Remark
Simplify notation
Define component-wise vector product
𝐱 ∘ 𝐲 =
𝑥1𝑥2𝑥3∘
𝑦1𝑦2𝑦3≔
𝑥1 ⋅ 𝑦1𝑥2 ⋅ 𝑦2𝑥3 ⋅ 𝑦3
No fixed convention in literature
The symbol “∘” only used in these lecture slides!
![Page 90: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/90.jpg)
Remark
Lighting Calculations
Need to perform calculations for 𝑟, 𝑔, 𝑏-channels
Often: 𝑜𝑢𝑡𝑝𝑢𝑡𝑟 = 𝑙𝑖𝑔ℎ𝑡𝑟 ⋅ 𝑚𝑎𝑡𝑒𝑟𝑖𝑎𝑙𝑟 ⋅ 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐯, 𝐥, 𝐧 𝑜𝑢𝑡𝑝𝑢𝑡𝑔 = 𝑙𝑖𝑔ℎ𝑡𝑔 ⋅ 𝑚𝑎𝑡𝑒𝑟𝑖𝑎𝑙𝑔 ⋅ 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛(𝐯, 𝐥, 𝐧)
𝑜𝑢𝑡𝑝𝑢𝑡𝑏 = 𝑙𝑖𝑔ℎ𝑡𝑏 ⋅ 𝑚𝑎𝑡𝑒𝑟𝑖𝑎𝑙𝑏 ⋅ 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛(𝐯, 𝐥, 𝐧)
Shorter 𝐨𝐮𝐭𝐩𝐮𝐭 = 𝐥𝐢𝐠𝐡𝐭_𝐬𝐭𝐫𝐞𝐧𝐠𝐭𝐡 ∘ 𝐦𝐚𝐭𝐞𝐫𝐢𝐚𝐥 ⋅ 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝐯, 𝐥, 𝐧
![Page 91: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/91.jpg)
Area Light Sources
Area Light Sources
Integrate over area
In practice often:
Sample with many point-light sources
Add-up contributions
𝐥
𝐯
𝐧
𝑛 light sources 1
𝑛 intensity
![Page 92: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/92.jpg)
Shading Effects
Shading effects
Diffuse reflection
“Ambient reflection”
Perfect mirrors
Glossy reflection
Phong / Blinn-Phong
(Cook Torrance)
Transparency & refraction
![Page 93: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/93.jpg)
Shading Effects
Shading effects
Diffuse reflection
“Ambient reflection”
Perfect mirrors
Glossy reflection
Phong / Blinn-Phong
(Cook Torrance)
Transparency & refraction
![Page 94: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/94.jpg)
Diffuse (“Lambertian”) Surfaces
Equation 𝑐 ~ cos 𝜃
Less light received at flat angles
𝐜 = 𝐜𝑟 ∘ 𝐜𝑙 ⋅ cos 𝜃
𝜃 𝐧
𝜃
𝐧 𝐧 surface normal
light color surface color
𝑐 – intensity (scalar)
𝐜 – color (RGB, ℝ3)
𝐜𝑟 – surface color (RGB)
𝐜𝑙 – light color (RGB)
(set to zero if negative)
![Page 95: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/95.jpg)
Diffuse (“Lambertian”) Surfaces
Equation 𝑐 ~ cos 𝜃
Less light received at flat angles
𝐜 = 𝐜𝑟 ∘ 𝐜𝑙 ⋅ cos 𝜃 ⋅
𝜃 𝐧
𝜃
𝐧 𝐧 surface normal
light color surface color
𝑐 – intensity (scalar)
𝐜 – color (RGB, ℝ3)
𝐜𝑟 – surface color (RGB)
𝐜𝑙 – light color (RGB)
Attenuation: 1
𝑑𝑖𝑠𝑡2
(point lights)
1
𝑑𝑖𝑠𝑡2
1
𝑑𝑖𝑠𝑡2
![Page 96: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/96.jpg)
Diffuse Reflection
Diffuse Reflection
Very rough surface microstructure
Incoming light is scattered in all directions uniformly
“Diffuse” surface (material)
“Lambertian” surface (material)
![Page 97: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/97.jpg)
Surface Normal?
What is a surface normal?
Tangent space:
Plane approximation at a point 𝐱 ∈ 𝒮
Normal vector:
Perpendicular to that plane
Oriented surfaces:
Pointing outwards (by convention)
Orientation defined only for closed solids
point 𝐱
surface normal 𝐧 𝐱 ∈ ℝ3
tangent space
𝒮
![Page 98: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/98.jpg)
Triangles
Single Triangle
Parametric equation
𝐩1 + 𝜆 𝐩2 − 𝐩1 + 𝜇 𝐩3 − 𝐩1 |𝜆, 𝜇 ∈ ℝ
Tangent space: the plane itself
Normal vector 𝐩2 − 𝐩1 × 𝐩3 − 𝐩1
Orientation convention: 𝐩1, 𝐩2, 𝐩3 oriented counter-clockwise
Length: Any positive multiple works (often 𝐧 = 1)
𝐩1
𝐩2
𝐩3
𝐧
![Page 99: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/99.jpg)
Triangle Meshes
Smooth Triangle Meshes
Store three different “vertex normals”
E.g., from original surface (if known)
Heuristic: Average neighboring triangle normals
![Page 100: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/100.jpg)
Lambertian Surfaces
Equation
𝐜 = 𝐜𝑟 ∘ 𝐜𝑙 ⋅ cos 𝜃 = 𝐜𝑟 ∘ 𝐜𝑙 ⋅ 𝐧, 𝐥
𝜃 𝐧
𝜃
𝐧 𝐧 surface normal
light direction normal vector
𝐧 𝐥
(assuming: 𝐧 = 𝐥 = 1)
![Page 101: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/101.jpg)
Lambertian Bunny
Face Normals Interpolated Normals
![Page 102: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/102.jpg)
Shading Effects
Shading effects
Diffuse reflection
“Ambient reflection”
Perfect mirrors
Glossy reflection
Phong / Blinn-Phong
(Cook Torrance)
Transparency & refraction
![Page 103: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/103.jpg)
“Ambient Reflection”
Problem
Shadows are pure black
Realistically, they should be gray
Some light should bounce around...
Solution: Add constant 𝐜 = 𝐜𝑎 ∘ 𝐜𝑎
Not very realistic
Need global light transport simulation for realistic results
ambient light color surface color
![Page 104: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/104.jpg)
Ambient Bunny
Pure Lambertian Mixed with Ambient Light
![Page 105: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/105.jpg)
Shading Effects
Shading effects
Diffuse reflection
“Ambient reflection”
Perfect mirrors
Glossy reflection
Phong / Blinn-Phong
(Cook Torrance)
Transparency & refraction
![Page 106: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/106.jpg)
Perfect Reflection
Perfect Reflection
Rays are perfectly reflected on surface
Reflection about surface normal
𝐫 = 2 𝐧, 𝐥 ⋅ 𝐧 − 𝐥 + 𝐥, 𝐧 = 1
𝐥 arbitrary
𝐧
𝐥 𝐫
![Page 107: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/107.jpg)
Silver Bunny
Perfect Reflection
Difficult to compute
Need to match camera and light emitter
More later:
Recursive raytracing
Right image: Environment mapping
Reflective Bunny (Interpolated Normals)
![Page 108: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/108.jpg)
Shading Effects
Shading effects
Diffuse reflection
“Ambient reflection”
Perfect mirrors
Glossy reflection
Phong / Blinn-Phong
(Cook Torrance)
Transparency & refraction
![Page 109: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/109.jpg)
Glossy Reflection
Glossy Reflection
Imperfect mirror
Semi-rough surface
Various models
![Page 110: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/110.jpg)
Phong Illumination Model
Traditional Model: Phong Model
Physically incorrect (e.g.: energy conservation not guaranteed)
But “looks ok”
Always looks like plastic
On the other hand, our world is full of plastic...
![Page 111: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/111.jpg)
0
0,2
0,4
0,6
0,8
1
1,2
-90 -60 -30 0 30 60 90
p=1 p=2 p=5 p=10 p=50 p=100
How does it work?
Phong Model:
“Specular” (glossy) part:
𝐜 = 𝐜𝑝 ∘ 𝐜𝑙 ⋅𝐫
𝐫,𝐯
𝐯
𝑝
Ambient part: 𝐜 = 𝐜𝑟 ∘ 𝐜𝑎
Diffuse part: 𝐜 = 𝐜𝑟 ∘ 𝐜𝑙 ⋅ 𝐧, 𝐥
Add all terms together
cos ∠𝐫,𝐯
𝐥
𝐯 𝐫
(high-) light color
Phong Exponents
𝐧
![Page 112: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/112.jpg)
Blinn-Phong
Blinn-Phong Model:
“Specular” (glossy) part:
𝐜 = 𝐜𝑝 ∘ 𝐜𝑙 ⋅𝐡
𝐡,𝐧
𝐧
𝑝
Half-angle direction
𝐡 =𝟏
𝟐
𝐥
𝐥+𝐯
𝐯
cos ∠𝐡,𝐧
𝐥
𝐯 𝐡 𝐧
In the plane: ∠𝐡
𝐡,𝐧
𝐧=1
2∠𝐫
𝐫,𝐯
𝐯
Approximation in 3D
![Page 113: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/113.jpg)
Phong+Diffuse+Ambient Bunny
Blinn-Phong Bunny Interpolated Normals
![Page 114: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/114.jpg)
Phong+Diffuse+Ambient Bunny
Blinn-Phong Bunny Interpolated Normals
![Page 115: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/115.jpg)
Cook-Torrance Model
Physically-Motivated Model
D – Infinitesimal micro-facets
Characterize by distribution
Expected reflection (density)
Gaussian, Beckmann,…
Approximate occlusion term (G)
F – Fresnel term
Model: wave-optics
Interaction of wave with surface under different angles
Percentage reflection/refraction 𝐹 𝜃 = 𝑅0 + 1 − 𝑅0 1 − cos 𝜃
5
cos 𝜃 = 𝐡, 𝐯 𝑅0 ="ratio of refractive indices"
𝑐𝑠𝑝𝑒𝑐 =𝐷 ⋅ 𝐺 ⋅ 𝐹
4 𝐯, 𝐧 𝐧, 𝐥
![Page 116: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/116.jpg)
Artistic “Fresnel” Reflection
unweighted reflection
Approx. Fresnel-Reflection
𝐹 𝜃 ∼ 1 − cos 𝜃 𝑝
Exponent 4
Exponent 5
![Page 117: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/117.jpg)
Better Models
Phong Bunny Cook-Torrance Model
![Page 118: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/118.jpg)
Shading Effects
Shading effects
Diffuse reflection
“Ambient reflection”
Perfect mirrors
Glossy reflection
Phong / Blinn-Phong
(Cook Torrance)
Transparency & refraction
![Page 119: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/119.jpg)
Transparency
Transparency
“Alpha-blending”
𝛼 = “opacity”
Color + opacity: RGB𝛼
Blending
Mix in 𝛼 of front color, keep 1 − 𝛼 of back color
𝐜 = 𝛼 ⋅ 𝐜𝑓𝑟𝑜𝑛𝑡 + 1 − 𝛼 ⋅ 𝐜𝑏𝑎𝑐𝑘
Not commutative! (order matters)
unless monochrome
50% red, 50% green
0.01.00.00.5
1.00.00.00.5
back
front
![Page 120: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/120.jpg)
Refraction: Snell’s Law
Refraction
Materials of different “index of refraction”
Light rays change direction at interfaces
Snell’s Law sin 𝜃1sin 𝜃2
=𝑛2𝑛1
𝑛1, 𝑛2: indices of refraction
vacuum: 1.0, air: 1.000293
water: 1.33, glass: 1.45-1.6
𝐧
−𝐧
𝜃1
𝜃2
𝑛2 𝑛1
![Page 121: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/121.jpg)
Refraction
Implementation
Not a local shading model
Global algorithms: mostly raytracing
Various “fake” approximations for local shading
Refraction
Reflection
(raytraced)
![Page 122: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/122.jpg)
Simple Shadows Global Illumination
3D Rendering Steps
Visibility Perspective
Geometric Model
Local Illumination
Smooth Shading
![Page 123: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/123.jpg)
core topics
important
CORE
Shading Algorithms
![Page 124: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/124.jpg)
Flat Shading
Flat Shading constant color per triangle
![Page 125: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/125.jpg)
Flat Shading
“Gouraud Shading” Algorithm compute color at vertices, interpolate color for pixels
![Page 126: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/126.jpg)
Flat Shading
“Phong Shading” Algorithm interpolate normals for each pixel
![Page 127: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/127.jpg)
Geometric Model
Perspective Visibility Local Illumination
Smooth Shading
3D Rendering Steps
Simple Shadows Global Illumination
Next: Advanced Rasterization
![Page 128: Graphics 2014 - Utrecht University · Announcements Practicals this week Tuesday (today) Tue 9-11 (was held) Tue 13-15 canceled (programming contest) Wednesday (tomorrow) Wed 15-17:](https://reader036.vdocuments.us/reader036/viewer/2022070901/5f4a34c31ee6f332570e7469/html5/thumbnails/128.jpg)
Geometric Model
Perspective Visibility Local Illumination
Smooth Shading
3D Rendering Steps
Simple Shadows Global Illumination
Global Illum: Keep this for later