Computer Graphics... Flashcards

(112 cards)

1
Q

Rendering

Methods of rendering

A

Representing 3D model as 2D image

Projection (rasterization) and ray tracing. Rasterization projects the vertices of the object
onto the pixels of the image. Ray tracing computes rays from each pixel to the object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

checking linearly dependence

Check span R^3

A

Gauss elimination if a = b = c then linearly independent.

if you can find any combo with the vectors that equal to zero

If stuck use determinant

if determinant = zero it does not span R3 and linearly dependent

determinant != 0 , it does span r3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

vector length?

A

sqaure root of (v1^2 + v2^2 + …)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

normalize a vector

A

v * 1/length of v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Dot product

Cosine angle between two products???

A

vector v and vector w

v1w1 + v2w2 + v3w3

Cos 0 = v .w/ ||v|| ||w||

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Orthogonal vectors?

A

Two vectors are orthogonal if they are perpendicular to each other ( dot product is zero

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Cross product ( vector v cross product vector w)

What does it give

A

v2w3 - v3w2
v3w1 - v1w3
v1w2 - v2w1

gives a vector perpendicular to both v and w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

OrthoNormaal Basis

A

Orthonormal if it consists of only unit vectors and each pair of vectors is orthogonal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

𝑓(π‘₯, 𝑦) > 0 β†’ the point is β€œabove” or β€œoutside” the curve
(depends on the curve shape),
➒ 𝑓 π‘₯, 𝑦 < 0 β†’ the point is β€œbelow” or
β€œinside” the curve (depends on the curve
shape).
➒ 𝑓 π‘₯, 𝑦 = 0 β†’ the point is β€œon” the curve,

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Implicit equation for 2D circle of radius r and oround origin is

A

F(x,y) = x^2 + y^2 - r^2 = 0

With centre c =
f(x,y) = (x-Cx)^2 + (y-Cy)^2 + (z-Cz)^2 - r^2 = 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Implicit Representation of Lines

A

𝐴π‘₯ + 𝐡𝑦 + 𝐢 = 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

implicit representation of
line passing through a point 𝑝0 = (π‘₯0, 𝑦0)
in the vector form???

A

n Β· (𝑝 βˆ’ 𝑝0) = 0

n = [-a, 1] (vector imagine it being vertical)
p = [x,y]
p0 = [x0,y0]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Implicit representation of planes

A

aπ‘₯ + 𝑏𝑦 + 𝑐𝑧 + 𝑑 = 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

equation of a plane with normal vector n = (a,b,c) through point p0 = (x0,y0,z0) is

A

n Β· (𝑝 βˆ’ 𝑝0) = 0
variable p = (x,y,z) for any point in the plane

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can plane be described using 3 non collinear points

A

let p1, p2, p3 be (xi,yi,zi)
we can describe the plane passing through p1,p2,p3 using
n Β· (𝑝 βˆ’ 𝑝0) = 0
where normal vector is given by cross product
n = (p2-p1) x (p3-p1)
p0 can be any of the points p1,p2,p3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is color

A

attribute of an object that is caused by the light being reflected or emmited by them

8 bits to represent each color so 2^8 possible values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How is RGB represented

A

In hexadecimal e.g abcf24
R = ab
G = cf
B = 24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is decimal for R G and B for abcf24

A

R = 10 * 16 + 11 = 171
G = 12 * 16 + 15 = 204
B = 2 * 16 + 4 = 36

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How does eye work with light

A

light enter eye hit retina. Cornea focus light on retina. Iris control amount of light entering eye

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Retina has millions of photoreceptors what are these types

A

Rods- for low light
Cones- for percieving color
3 types for 3 values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

RGB and CMY color space

A

RGB model (0,0,0) black (255,255,255) white
CMY - subtraactive as new colors brings result closer to black

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How to convert RGB to CMY

A

take RGB vector and subtact it from vector (1,1,1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

parametric representation of a
line through the points 𝑝0 and 𝑝1

A

x = x0 + t(x1-x0)
y= y0 + t(y1-y0)

Vector form
p(t) = p0 + t(p1-p0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Find intersection point of line and plane

A

first combine
β–ͺ the parametric representation of the line, and
β–ͺ the implicit equation of plane.

look in book

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
line and sphere intersection point
sphere : (x-Cx)^2 + (y-Cy)^2 + (z- Cz)^2 - r^2 = 0 line : p(t) = p0 + t(p1-p0) == p(t) = s + td intersect is (sx + tdx - Cx)^2 + (sy + tdy - Cy)^2 + (sz + tdz - Cz) ^2 - r^2 = 0
26
Tesselattion Triangulation
Covering a surface using polygon Drawing diagonals between non adjacenet vertices and diagonals dont intersect
27
Convex polygon?
if any straight line joining 2 points of the polygon is contained within is convex otherwise concave
28
How many ways to triangulate a k+2 sided polygon
Sum 𝑖=0 π‘›βˆ’1 πΆπ‘–πΆπ‘›βˆ’π‘–βˆ’1
29
Data structures to store mesh
vertex-vertex meshes Stores each vertex together with list of verticies its connected to adv- storage fficient dis - must do computational work to generate faces and edges face-vertex meshes consist ordered list of vertices and faces. for each vertex, list the faces it velongs to Half -edge meshes Each edge defines two half-edges, one in each direction. For each half-edge we store its twin, the next half edge around the polygon, the face it belongs to, the previous half edge.
30
Deluanay traingle?
For every point p - If p is outside or on the circumcircle β†’ triangle is Delaunay. - If any point lies inside the circumcircle β†’ triangle is not Delaunay.
31
Bezier curves
For degree n, we begin n+1 control points p0... pn The first 2 points define start and end t range is 0 and 1 ( some point on line) Linear interpolate (1-t)A + tB
32
Bezier curve with 3 points P1, P2, P3
Interpolate P0 and P1 Q0 = (1-t)P0 + tP1 Interpolate P1 and P2 Q1 = (1-t)P1 + tP2 Interpolate between Q0 and Q1 and plug in t (1-t)^2P0 + 2t(1-t)P1 + t^2P2
33
Binomial expansion formula And NCK formula
sum of k = 0 to k = n (NCK) x^k where n is the power n! / k!(n-k)!
34
Bezier curve formula in general b(t)
Sum from k = 0 to k = n (nCk) t^k (1-t)^n-k bk
35
Illuminaiton models Light component types
Direct illumination - Light Arrives straight from light sources Indirect illumination- Light arrives after interacting with rest of scene Ambient light - Uniform from all directions. Consistent amount of light applied to every point Diffuse Light - Light comes from specific direction. Light reflected with equal intensity in all directions Specular light - highlights on shiny objects. Positiion of viewer important
36
Phong model
Compute lighting at each vertex 𝐼 = π‘˜π‘Žπ‘šπ‘*πΌπ‘Ž + π‘˜π‘‘π‘–π‘“π‘“*𝐼𝐿(π‘™βˆ™ 𝑛) + π‘˜π‘ π‘π‘’π‘πΌπΏ(π‘Ÿβƒ— βˆ™ 𝑣⃗)^𝛼 kamb - constant for ambient reflectivity of matreial Ia is ambient light intensity kdiff is a constant for diffuse reflectivity of material IL is intensity of light source kspec is constant for specular reflectivity of material Vector to light source l Vector to viewer (camera) v Normal vector n (Mirror/perfect) reflection vector r
37
How to find reflection vector r
r = l + 2u this equals l + 2(n-l) this equals 2(n . l)n-l
38
How to calculate ambient light
πΌπ‘Žπ‘šπ‘ = π‘˜π‘Žπ‘šπ‘*πΌπ‘Ž
39
How to calculate diffuse light
𝐼𝑑𝑖𝑓𝑓 = π‘˜π‘‘π‘–π‘“π‘“*𝐼𝐿 * 𝑙 βˆ™ 𝑛 = π‘˜π‘‘π‘–π‘“π‘“*𝐼𝐿 cos x
40
how to calculate specular light
𝐼𝑠𝑝𝑒𝑐 = π‘˜π‘ π‘π‘’π‘*𝐼𝐿( π‘Ÿ βˆ™ 𝑣)^a = π‘˜π‘ π‘π‘’π‘*𝐼𝐿 (cos) 𝛾^𝛼 a is shininess coefficient
41
Continuous meaning for C^0 C^1 C^i
C^0 -> function is continuous C^1 -> its derivative is also continuous C^i = its ith derivative exist and continous
42
how to know if curve of two beziers are continuous for c1
For a quadratic BΓ©zier at the end: Tangent∝P2βˆ’P1 For a linear BΓ©zier at the start: Tangentβˆπ‘„1βˆ’π‘„0 if there equal then yes ​
43
Explain shading methods
Flat Shading- Each vertex of each polygon has the same color and color whole
44
Gouraud shading
Verticies have differnet colors. Interpolate those colors over surface of a triangle
45
Gourauad shading only using weights for each vertice
T has verticies V1, V2, V3 Then Wi = 1/distance(Vi,P) Then color c(P) = W1C(P1) + W2C(P2) + W3C(P3) / w1 + w2 + w3
46
Gouraud shading with barycentric coordinates
Imagine we are interpolating the triangle with three points A = 𝑋1, π‘Œ1 , 𝐡 = 𝑋2, π‘Œ2 and C = X3, Y3 : Just remember this equation A+π‘Š2( 𝐡 βˆ’ 𝐴) + π‘Š3(𝐢 βˆ’ 𝐴)
47
Phong Shading
Phong shading interpolates the normal Phong Shading: Lighting equation used at each pixel Interpolate normal of the two verticies N= y-y1/y2-y1 N1 + y2-y/y2-y1 N2
48
Projection and rasterisation
49
Ray tracing and how to waste less computational resources
trace the rays of light to model the interaction of light with objects. Use backward ray tracing to trace rays from camera to the object
50
Ray types
Primary ray -ray that leaves eye and travels out to scene Secondary ray- ray that doesent leave eye
51
Types of secondary Rays
Shadow rays- from surface point towards light source Reflection rays -from surface point in mirror direction Refraction ray- from surface point in refracted direction
52
Snells law
r1sin(x) = r2sin(y)
53
w to compute refraction vector t
t = -an + v where a is a scalar and v is perpendicular to n and n is the normal vector
54
Vector spaces conditions
must be closed under scalar multiplication and vector addition Z^2 is not a vector space as (1,0) x 0.5 = (0.5,0) not integer
55
Subspace
W is a subset of vectors in V and V is a vector space. if w is also a vector space then its a subspace of v.
56
Linear map? Operator
Function taking vector from 1 vector space as input and outputting a vector in another Map from vector space to itself
57
Conditions for liniear map to be linear for any 2 vectors u , v
F(Ξ»v) = Ξ»f(v) : Homogeneity f(u + v) = f(u) + f(v): addictivity i guess u and v and just be anything e.g u = (x,y) v = (z,w)
58
Linear map format What is Image of L Kernel of L
L : X -> Y X = domain of L, Y is range Image of L is set of vectors I (subset) Y which l maps some vertex of x Kernel of L is set of vectors k (Subset) X which are mapped by L to zero vector
59
Linear map R^2 -> R^2 such L(x,y) = (x,2x) What is kernel Image
k = {(x,y) : x = 0} I = {(x,2x) : x E R}
60
Dimension of kernel k of l Dimension of image I of L Dim(X) formula
nullity of L Rank of L Dim(X) = Rank(L) + nullity(L)
61
rank of matrix
Equal to number of linearly indepepndednt columns of M The number of non-zero rows in the row reduced matrix is the rank of the matrix.
62
Finding identity Inverse of matrix A^-1
AA^-1 A
63
Invertivble matrix nxn meaning
nxn matrix is invertible if it has rank n
64
How to check matrix does not have inverse Determinant of 2x2 matrix Determinant of 3x3 matrix
if determinant = 0 a11a22 - a12a21 a11C11 + a12C12 + ...A1nC1n Find Cofactor Cij = (-1)^i+j Mij Find Mij = remove row i and col j and take determinant of matrix remaining
65
Finding Volume with determinant
For matrix M and shape T New area = det(M) x original area
66
inverse 𝐴^βˆ’1 of an invertible matrix 𝐴:
adjoint A/ |A| adjoint A is transpose of cofactor matrix of A
67
Matrix transformations Scaling |3, 0| |x| = ? |0, 3| |y| =
|3x| |3y|
68
Shearing in X direction? Shearing in Y direction
X perserves y Cord |1 s | | x | = |x + sy| |0 1 | |y| = | y | Y perserves x cord |1 0| |x| = | x | |s 1| |y| = | sx + y|
69
reflection matrix y=x matrix for y = -x reflection matrix through y axis through x axis
|0 1| |x| = |y| |1 0| |y| = |x| 0 βˆ’1 βˆ’1 0 βˆ’1 0 0 1 1 0 0 βˆ’1
70
rotate counter-clockwise at particular angle ΞΈ Matrix Rotate clockwise
|cosΞΈ -sinΞΈ| |sinΞΈ cos ΞΈ| |cosΞΈ sin ΞΈ| |-sinΞΈ cosΞΈ|
71
orthographic projection Formula? for projb(a)
orthographic projection of a onto b tells us the component of a that travels in the same direction as b. a . b ------- b b . b Cos(ΞΈ)=||proj(a)|| / ||a||
72
Multiple transformation order?
Right most tranfsofrmation first Order just do rotate, reflect, shear, scale
73
Translation in 2D
x' = tx + x y' = ty + y just add x and y values to original values
74
translation in 2D using homogenous coordinates
1 0 𝑑x 0 1 ty 0 0 1 extend og x,y to (x,y,1) to use 3x3 matrix TM . [x,y,1] = -dot product both to get |x + tx| |y + ty| | 1 |
75
Affine transformations
Add the 001 00 around the matrix for , rotatiton, scaling
76
Scaling matrix in 3D And rotation
|sx 0 0| |0 sy 0| |0 0 sz| Same as 2D with the 001 thing on outside
77
Translating in 3D Homogenoues coordinates in 3D
point p = [x,y,z,1] matrix uses 4x4 matrices [a11, a12, a13, tx] [a21, a22, a23, ty] [a31, a32, a33, tz] [0, 0, 0, 1 ] M . P = [x + tx] [y + ty] [z + tz] [ 1 ]
78
Inverse Transformation for scaling
doubles x coord and thirds y coord
79
Inverse transformation for shearing in x direction
[x - sy] [ y ] [x ] [sx-y]
80
inverse transofrmation for reflection in line y=x
also [y] [x]
81
Coordinate systems
local coordinate system World coordinate system Eye coord system Normalized device coordinates
82
Coordinate transformations
Modelling Transformation: local coordinates β†’ world coordinates 2. Camera Transformation: world coordinates β†’ eye coordinates 3. Projection Transformation: eye coordinates β†’ NDC 4. Windowing Transformation: NDC β†’ image coordinate syste
83
How does modeling transformation work
π‘Ž11 π‘Ž12 π‘Ž13 𝑑1 π‘Ž21 π‘Ž22 π‘Ž23 𝑑2 π‘Ž31 π‘Ž32 π‘Ž33 𝑑3 0 0 0 1 basically an affine transformation, use 4x4 matrix
84
Camera transformation
Step 1 : Translation 1 0 0 -Cx 0 1 0 -Cy 0 0 1 -Cz 0 0 0 1 // subtract camera position so its postion becomes 0,0,0 step 2: //cam has 3 direction vectors u(right),v(up),w(forward) wx wy wz 0 vx vy vz 0 -ux -uy -uz 0 0 0 0 1 Step 3 Mcamera = Mr Mtr
85
Projection transformation Types of projection
generate a 2D image by Projecting objs onto view plane Parallel projection (orthographic or othogonal proj) - Maps 3D points to 2D by moving them along a projection direction until they hit an image plane. Perspective Projection = maps 3D points to 2D by projecting them along lines that pass through a single viewpoint until they hit an image plane
86
Difference between orthographic vs perspective projection
orthographic - Specified by a direction of projection - less realistic - parallel lines remain parallel Perspective - Specified by a centre of projection (camera) and the distance from this centre and the image plane -looks realistic -distances and angles not perserved
87
Viewing Frustrum? Clipping?
area in 3D space that is visible from a camera and may appear on the screen. Eliminating the portion of scene that Is outside the viewing frustum is called clipping Discard objects that cant be viewed
88
Sutherland-Hodgman polygon clipping Algorithm rules
For each edge with first point v1, v2 1st Vertex , 2nd Vertex , Output Inside Inside Save 2nd Vertex Inside Outside Save Intersection Outside Outside None Outside Inside Save 2nd vertex and intersection
89
How do computers store the color values of the pixels
Frame buffer This is a 2D array which has same size of the screen. The GPU writes the color value into the frame buffer. Then the display reads the color values from frame buffer and puts each value onto the screen
90
Face culling
determines if triangle is front facing or backfacing by order of verticies after projected onto screen. if the order is counter-clockwise, the triangle is front facing, if clockwise, it’s back facing.
91
Rasterization
process of finding and filling the pixels that are inside those primitives. (also scan conversion of a point)
92
How to do scan conversion of a point
Given some point x,y we need to choose a pixel to place that point in. Option 1. X’ = floor(x), Y’ = floor(y) Option 2. X’=floor(x+0.5), Y = floor(y+0.5)
93
Digital Differential analyzer algorithm
y= mx + b if m < 1 use formula: Xβ‚–β‚Šβ‚ = Xβ‚– + 1 Yβ‚–β‚Šβ‚ = Yβ‚– + 1 Else use formula Yβ‚–β‚Šβ‚ = Yβ‚– + 1 Xβ‚–β‚Šβ‚ = Xβ‚– + 1/m
94
DDA general form
find delta(x) find delta(y) Q = 1/max{|delta(x), delta(y)|} Xβ‚™β‚Šβ‚ = Xβ‚™ + Q * delta(x) Yβ‚™β‚Šβ‚ = Yβ‚™ + Q * delta(y)
95
Advantage and disadvantage of DDA
Simple and easy to implment Faster than direct use of the line equation since it avoids floating point multiplications. Disadvantages: * Deals with rounding and floating point arithmetic * Slower that breshams line generation
96
Breseham’s line generation algorithm benefits and step
Dda uses floating-point additions and this alg avoids that. Step1: Calculate β–³ x and β–³y Step 2: Calculate decision parameters D = 2β–³y - β–³x say D = 0 Step 3: Find next point based on D if D < 0 -->D = D + 2dy then next pixel is (x+1, y) if D >=0 -->D= D + 2(dy-dx), next pixel is (x+1, y+1)
97
Triangle rasterization methods
Edge equation Scan line equation(look in book) Barycentric coordinates
98
Barycentric equations remember this
𝛼+Ξ²+𝛾=1, is inside of the triangle if and only if: 0≀𝛼,Ξ²,𝛾≀1
99
Use the Barycentric coordinate system to calculate the color of the point p0 = (2,8).
c=Ξ±c1+Ξ²c2+Ξ³c3 get that than apply it to each color presented
100
Edge equations
for each vertices of polygon create edges. e.g AB and determine the equation of that line. now determine its positive half space
101
Texture mapping Advantages
Use smaller number of triangles for a model and map a precomputed image onto them Lower rendering time Easily change object appearance
102
Texels?
Texture pixel corresponding to points from UV coords if number of texels is same as number of pixels, we can expect sample to be fairly accurate representation of texture if smaller than number of pixels, Than we will color many pixels alike(blurry) if larger than number of pixels, produce less detailed images
103
Texture magnification Method for this
Used when texutre image we sample uses less texels than number of pixels in our polygon so our texels are larger than pixels Nearest neighbor mangification- for pixel (5,5) scale x = original width/ output width scale y = original height/ output height src x = xpixel(5) * scale x src y = ypixel(5) * scale y Then round
104
Bilinear interpolation method
say x-coordinate odd β†’ green (0,1,0) x-coordinate even β†’ red (1,0,0) find x and y texel xtexel = xpixel * texel width/image width ytexel = ypixel * texture height/image height ID SURRONDING TEXELS xfloor​=floor(xtexel​),yfloor​=floor(ytexel​) //BOTTOM LEFT COMPUTE FRACTIONAL DISTANCES fx = xtexel - xfloor fy = ytexel - yfloor than interpolate horizontally C(bottom) = Q11 + fx * (Q21 - Q11) // Q11 is green so (0,1,) C(top) same way with Q12 --> Q22 Than interpolate vertically C=Cbottom​+fy​⋅(Ctopβ€‹βˆ’Cbottom​)
105
Texture minification
Texture minification is required when the texture image is larger (has more pixels) than the image to be mapped.
106
Bump mapping
Use textures to alter the surface normal but does not change actual shape of surface
107
Lightmap Benefits Drawback
process of pre-calculating the brightness of objects in a scene and storing the result in a texture map for later use. provide lighting effects such asΒ global illuminationΒ at a relatively low computational cost. lighting of surface cannot be changed in real time/
108
Image processing e.g
noise reduction super resolution deblurring
109
Image processing : contrast enhancement Image Colorization Image Harmonization
Increase visibility of objects by amplifying difference between colors of objects and colors of their backgrounds Process of adding color information to monochrome photos Framework that matches the visual appearances of images before blending them
110
Image quantization
Lossy compression technique achieved by compressing a range of values to a single value
111
MiniMap Image Histogram
Allows to store an image in fewper pixels at cost of lower quality we store the number of pixels in each color.
112
Name the 4 types of convolutional filters
Sobel filter: creates an image (feature map) emphasising edges. Laplacian filter: used to find areas of rapid change (edges) in images Sharpening Filter: emphasize details and enhance the edges of objects in an image Gaussian filter: image smoothing