tenta frågor Flashcards

1
Q

What does the fragment shader do? (Hint: what is its input and output and
when is it executed?)

A

Receives interpolated values from vertex shader and computes fragment
color. E.g., refines lighting, adds textures, may modify depth

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

What is the z-buffer for?

A

to resolve visibility / avoid depth sorting.

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

While a normal might be normalized in the vertex shader, why do we generally
need to normalize it again in the fragment shader?

A

As values get interpolated between the vertices from the vertex shader to
the fragment shader, the interpolated normal in not necessarily normalized.

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

How can you implement fog using the fragment shader?

A

E.g., (linearly/exponentially) blend between the fragment color and fog
color based on the fragment’s depth. To get full points, draw or explain in more
detail

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

Normally, you would want to draw all geometry that is in front of the camera.
So, why is a near and far plane used for the view frustum?

A

Near plane is used to avoid a degenerate projection plane. Far plane can be
used to get better z-precision in the z buffer.

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

Describe a test which determines whether or not a sphere and a plane intersect

A

Insert the sphere center into the plane equation. If the result is smaller than
the radius, there is an intersection.
I.e., ||n•c + d|| <= r.

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

Describe a top-down approach to build an Axis Aligned BSP-tree for a scene.

A

Create minimal AABB around the whole scene. Split along an axis.
Recursively split the 2 parts alongs a new axis. Terminate if empty node, #triangles
< threshold or level >= max recursion depth. (Axis aligned: x-,y-,z-axis are the split
planes.)

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

Why can’t we use ray tracing to do an exact object-object collision detection
test?

A

Only tests a discrete subset of surface points and directions. A finite set of
rays may miss small intersections.

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

What is the point of using dynamic collision detection tests?

A

Objects may collide in space and time although they never collide in any
of the frames rendered at discrete time steps.

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

What is a BRDF? (You can answer by stating what the abreviation BRDF
stands for and assuming f() is a BRDF and describe its input parameters and what it
returns.)

A

Bidirectional Reflection Distribution Function. The function f(ωi
, ωo)
returns how much of the radiance from the incoming direction ωi
that is reflected in
the outgoing direction ωo.

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

What is caustics?

A

specular reflections or refractions that focus light

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

Describe the shadow map algorithm

A
  1. Render a shadow (depth) map from the light source.
  2. Render image from the eye. For each generated pixel, transform/warp the x,y,zcoordinate to light space and compare the depth with the stored depth value in the
    shadow map (at the pixel position (x,y).
    If greater → point is in shadow.
    Else → point is not in shadow.
    (Bias/offset is necessary due to disretization and precision problems.)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Tell which type of curve each image corresponds to. You can choose between
Bezier curve, Interpolation-curve, and Hermite-curve. To get any points, you must
also motivate your choice!

A

a) interpolation curve since the curve goes through the control points. b)
Hermite-curve since gradients are specified per control point. c) Bezier-curve since
two intermediate points are used to approximate the gradients in the end points.

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

What is direct illumination and what is indirect illumination? (No formulas
needed - words are enough.)

A

Direct illumination is the light that comes directly from a light source.
Indirect illumination is the inter-reflected light, such as reflections, irradiance,
shadows, caustics, etc.

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

Linear interpolation of (u,v) in screen space does not give perspective correct
texturing. Describe how perspective correct texture interpolation can be achieved.

A

In screen space, linearly interpolate (u/w, v/w, 1/w) from each vertex.
Then, per pixel: ui
= (u/w)i
/ (1/w)i
, where i means screen space interpolated value.

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

Give two reasons for gamma correction

A

1) screen output is non-linear so we need gamma to counter that. 2)
Textures/images can be stored with better precision (for human eye) for lowintensity regions.

17
Q

Describe how anisotropic filtering works. Also tell why it is needed

A

Up to for instance 16 mipmap lookups along the line of anisotropy.
A different amount of filtering in the x and y direction is generally needed.

18
Q

Describe a method for a ray-polygon intersection test. (You may assume that
the polygon is convex and lies in a 3D plane.)

A

convert to a point-in-2D-polygon test and

use, for instance, the crossing number algorithm / even-odd rule

19
Q

] How do you nicely terminate recursion in ray tracing if you do not simply want
to terminate at a maximum recursion depth?

A

terminate when the ray’s influence on the final pixel color is below a
certain threshold. (Send a weight with the reflection/refraction rays.)

20
Q

Explain how a skippointer tree works and what the advantage is?

A

The (BVH)-tree stored in depth first traversal order, sequentially in an
array, with a pointer/index to the next element if traversal of subgraph should be
skipped. Advantage: gives good cache coherence.

21
Q

Explain Final Gather and how it is used with the photon maps. Also, explain
what is good with Final Gather.

A

Monte Carlo-sample at first bounce using many stochastic rays. (Use
caustics map at first intersection and global+caustics) photon map at intersections of
secondary rays. Good because lowers noise from the global map. (No reduction if
caustics and global map are not specified.)

22
Q

How are soft shadows from an area-light source computed with path tracing?

A

At each intersection, one shadow ray is shot to one random position on the
light source.

23
Q

Why do you need to use a bias in the shadow map algorithm? What is the cause
of the problem?

A

We compare two different discretizations - one from the eye and one from
the camera. (To avoid z-fighting (incorrect self shadowing) and light leaking.) The
view sample can lie further from the light than the shadow map sample (due to
discrete sampling).

24
Q

] Consider a game where the model-matrix (the position and orientation) for a car is
described by a translation matrix, T, and a rotation matrix, R, as given below.
1. (1p) When the user presses a key, the car should move 2.0 units in the world-space
x direction. How would you modify the translation matrix?
2. (2p) How would you modify the rotation matrix for the car to turn slightly to the
left?
3. (1p) When the user presses the “up-arrow” key, the car shall move forward in the
direction it is facing. How do you modify the matrices?
4. (1p) We now want a camera from inside the car (at the car’s position and facing in
the rz direction). How can you calculate this matrix?

A
  1. tx = tx + 2
  2. You must show that you understand that rz and rx should be rotated around ry
    (E.g., from the labs):
    rz += 0.01 rx
    normalize rz
    rx = rz × ry
  3. (tx, ty, tz) += 0.1 rz
    (0.1 is just an example)
  4. V = (TR)
    -1
25
Q

[2p] Show how to compute the intersection between a ray and a sphere (in 3D).

A
Answer: See slides from lecture 6.
Sphere center: c, and radius r
Ray: r(t)=o+td
Sphere formula: ||p-c||=r
Replace p by r(t): ||r(t)-c||=r and solve for t. Return r(t).
26
Q

[3p] Describe how the z-fail algorithm works

A

Answer: Create shadow quads from the silhouettes of the shadow caster (as seen from
light source). Capping planes are necessary. Render ambient occlusion to color buffer.
Turn off updating of z-buffer and rendering to color buffer. Invert z test, i.e., use
GL_GREATER. Render front facing (as seen from camera) shadow volume polygons to
stencil buffer, decrementing stencil values. Render back facing shadow volume
polygons to stencil buffer, incrementing stencil values. Render diff+spec lighting
contribution to color buffer where stencil buffer = 0

27
Q

[2p] In which ways are NURBS more general than B-Splines?

A

Answer: control points can be set at non-uniform intervals and they can have different
weights.

28
Q

) [5p] Postprocessing: You have a scene of a spaceship which you render with a shader
called FancyShader, to a texture, OffScreenTexture. To the rendered result, you want to
apply a post-processing effect that generates a gray-scale image.
1. (3p) Order all of the following steps such that you would end up with a grayscale
image of the spaceship in your window:
A. Draw Spaceship
B. Bind GrayScaleShader
C. Draw fullscreen quad
D. Clear rendertarget
E. Bind OffScreenTexture to texture unit 0
F. Bind OffScreenTexture as rendertarget
G. Bind Window (default framebuffer) as rendertarget
H. Bind FancyShader
2. (1p) This is an effect that could instead be implemented directly in FancyShader.
Why could there be a performance advantage of doing it as a post-processing pass
(especially for more computationally heavy effects)?
3. (1p) Most/Many post-processing effects, like blur, can not be implemented in
FancyShader. Why not?

A

Answer:
1: E.g.: F, D, H, A, G, E, B, C
Actually any of these orders work: ((F → D)/H) → A → (G/E/B) → C, where → means
strict order and / means any order.
2: The performance then scales with pixels, not fragments (or geometry).
3: Need to know result of neighbouring pixels

29
Q

[2p] Which types of filters are common in real-time computer graphics for minification
of 2D textures? (Each listed wrong filter will give negative score. Sum will however not
go below 0p.)

A

Answer: nearest (box), biliear filtrering (tent) with and without mipmapping. Trilinear
filtering with mipmapping, anisotropic filtering