## Task 1: Transformation Pipeline
Version A:
- a1)
A(3, 0, 0)
B(5, 1, 3)
C(2, -2, 1)
- a2)
A(3/sq2, 0, -3/sq2)
B(4*sq2, 1, -sq2)
C(3/sq2, -2, -1/sq2)
or
A(2.12, 0, -2.12)
B(5.65, 1, -1.41)
C(2.12, -2, -0.7)
- a3)
A(1.5, 0, 1.5)
B(4, -1, 1)
C(1.5, 2, 0.5)
- a4)
A(2.5, 1, 2.5)
B(5, 0, 2)
C(2.5, 3, 1.5)
- b)
[[ 0.5 0. 0.5 1. ]
[ 0. 1. 0. 1. ]
[ 0.5 0. -0.5 1. ]
[ 0. 0. 0. 1. ]]
- c)
[[ 0 0 1 -1]
[ 0 1 0 -1]
[-1 0 0 1]
[ 0 0 0 1]]
- d)
A(1.5, 0, -1.5)
B(1, -1, -4)
C(0.5, 2, -1.5)
- e)
[[ 0.05 0. -0.05 0. ]
[ 0. 0.2 0. 0. ]
[-0.2 0. -0.2 3. ]
[ 0. 0. 0. 1. ]]
- f)
[[ -0.60355339 0. 0.60355339 0. ]
[ 0. -2.41421356 0. 0. ]
[ 1.5 0. 1.5 -20. ]
[ -0.5 0. -0.5 0. ]]
- g)
A(2218.82, 540, 10.33)
B(1249.70, 314.08, 2)
C(1346.27, 2278.23, 10.33)
Version B:
- a1)
A(5, 0, 0)
B(4, 2, 5)
C(2, -3, 3)
- a2)
A(5*sq2/2, 0, -5*sq2/2)
B(9*sq2/2, 2, sq2/2)
C(5*sq2/2, -3, sq2/2)
or
A(3.53, 0, -3.53)
B(6.36, 2, 0.70)
C(3.53, -3, 0.70)
- a3)
A(2.5, 0, 2.5)
B(4.5, -2, -0.5)
C(2.5, 3, -0.5)
- a4)
A(3.5, 1, 3.5)
B(5.5, -1, 0.5)
C(3.5, 4, 0.5)
- b)
[[ 0.5 0. 0.5 1. ]
[ 0. 1. 0. 1. ]
[ 0.5 0. -0.5 1. ]
[ 0. 0. 0. 1. ]]
- c)
[[ 0 0 1 -1]
[-1 0 0 1]
[ 0 -1 0 -1]
[ 0 0 0 1]]
- d)
A(2.5, -2.5, -2)
B(-0.5, -4.5, 0)
C(-0.5, -2.5, -5)
- e)
[[ 0.05 0. -0.05 0. ]
[-0.1 0. -0.1 0. ]
[ 0. -0.4 0. 2.2 ]
[ 0. 0. 0. 1. ]]
f)
[[ -0.6036 0. 0.6036 0. ]
[ 1.2071 0. 1.2071 0. ]
[ 0. 3. 0. -14. ]
[ 0. -1. 0. -2. ]]
g)
A(2408.52, -1089.59, 7, 1)
B(inf, inf, -inf)
C(844.11, -111.83, 1)
## Task 2: Curve and Geometry
- a) Any points with any given t can derive a valid answer,
For easy calculation, we can use t = 0.5
- b)
createDeCasteljauPointAt(cp, t) {
for (let j = 0; j < cp.length; j++) {
for (let i = 0; i < cp.length-j-1; i++) {
cp[i].x = t*(cp[i+1].x - cp[i].x) + cp[i].x
cp[i].y = t*(cp[i+1].y - cp[i].y) + cp[i].y
}
}
return cp[0]
}
- c) (A-C)+(B-D)
- d) Speed up rendering efficiency. Topology change. Because merging vertices can result dangling triangles.
- e) Interpolat and gain smooth surface. Can only work with triangulated meshes
- f) Mesh aliasing. aliasing errors can occur if the sampling pattern is not perfectly aligned to features in the original geometry
## Task 3: Rendering Pipelines
Version A:
- a) Primitive generation (or Tessellation). As few polygons as possible - fewer for smooth surfaces and more for curved surfaces. Or: creation of fine structures close to the camera.
- b) Culling avoids rendering unnecessary objects such as outside view frustum, back faces, etc. Culling is important for BVH construction, which can be used both for rasterization and ray tracing speedup.
- c) 1) AABB, 2) face normal, 3) z value (from depth buffer), or ray hint
- d) Sort objects based on depth value, then render from far to near; This approach cannot solve, for instance, polygons A B and C that overlapping one anohter; Depth test happends in between vertex processing and fragment processing.
- e) Ray tracing is physically based which trace rays from pixel to the light source; Computation efficiency; Denoising; Can interpolate pixel color with low samples per pixel (spp)
Version B:
- a) Ray tracing is physically based which trace rays from pixel to the light source; Computation efficiency; Denoising; Can interpolate pixel color with low samples per pixel (spp)
- b) Primitive generation (or Tessellation). As few polygons as possible - fewer for smooth surfaces and more for curved surfaces. Or: creation of fine structures close to the camera.
- c) Culling avoids rendering unnecessary objects such as outside view frustum, back faces, etc. Culling is important for BVH construction, which can be used both for rasterization and ray tracing speedup.
- d) 1) AABB, 2) face normal, 3) z value (from depth buffer), or ray hint
- e) Sort objects based on depth value, then render from far to near; This approach cannot solve, for instance, polygons A B and C that overlapping one anohter; Depth test; Happends in between vertex processing and fragment processing.
## Task 4: Material
- a)
0.5, 0.0 // v0
1.0, 0.0 // v1
1.0, 0.5 // v2
0.5, 0.5 // v3
- b)
[texCoord[0], texCoord[1], texCoord[3]]
[texCoord[1], texCoord[2], texCoord[3]]
- c) Yes. mipmap is used for range query
- d) Bidirectional Reflectance Distribution Function. Because it defines how light should be reflected whereas texture color is only the emission of a surface.
- e)
Version A: Lambertian, Equal reflectance on all directions.
Human skin is a material that need subsurface scattering support.
Version B: Glossy, Incoming flux from direction is scattered, but concentrated around the reflection direction
Human skin is a material that need subsurface scattering support.
## Task 5: Illumination
- a) Sets the color value (vec4, RGBA) for the current fragment.
- b) Formula: intensity = dot(lightingDirection, vNormal); Calculate angle between normal and direction of light source. the smaller the angle, the greater the intensity
- c) Vertex shader. "In" interpolates this value over the fragments of the primitive.
- d) Map the interpolated intensity to four predefined colors.
- e) Non-Photorealistic-Rendering
- f) phong, flat, gouraud
- g) fragment shader, fragment shader, vertex shader
- h) light, normals, color
- i) a polygon is only rendered in one pixel
- j) see tutorial slides 6-material, page 37
- k) render efficiency. deferred shading (no shading is actually performed in the first pass of the vertex and pixel shaders: instead shading is "deferred" until a second pass.)