varying vec2 v_uv;
void main() {
vec3 dark = vec3(0.1, 0.1, 0.1);
vec3 light = vec3(0.9, 0.9, 0.9);
vec2 xy = abs(fract(v_uv / 0.25) - 0.5);
float d = max(xy.x, xy.y);
float e = fwidth(d) / 2.0;
float dc = smoothstep(0.125 - e, 0.125 + e, d);
gl_FragColor = vec4(mix(dark, light, dc), 1.0);
}
Replace by and use to apply the shader to the square on the left so that it looks like the one on the right.
Note: the same shader is used for the sphere and the ground plane (rotate camera to see).
📗 [1 points] Given the following shader pair. They are applied to a square (two triangles) with U, V with UV values ranging from \(0, 1\).
varying vec2 v_uv;
void main() {
vec3 dark = vec3(0.1, 0.1, 0.1);
vec3 light = vec3(0.9, 0.9, 0.9);
vec2 xy = abs(fract(v_uv / 0.25) - 0.5);
float d = max(xy.x, xy.y);
float e = fwidth(d) / 2.0;
float dc = smoothstep(0.125 - e, 0.125 + e, d);
gl_FragColor = vec4(mix(dark, light, dc), 1.0);
}
Replace by and use to apply the shader to the square on the left so that it looks like the one on the right.
Note: the same shader is used for the sphere and the ground plane (rotate camera to see).
📗 [1 points] Given two rotations \(r_{1}\) = , \(r_{2}\) = using axis angle representations \(\left(\theta; x, y, z\right)\) with \(\left\|\begin{bmatrix} x \\ y \\ z \end{bmatrix}\right\| = 1\), what is the composition of the two rotations \(r_{1} + r_{2}\) = .
➩ To convert from axis angle to quaternions, use the formula, \(q = \left(\cos\left(\dfrac{\theta}{2}\right), x \sin\left(\dfrac{\theta}{2}\right), y \sin\left(\dfrac{\theta}{2}\right), z \sin\left(\dfrac{\theta}{2}\right)\right)\).
➩ To multiply two quaternions, you can use this tool: \(q_{1}\) = , \(q_{2}\) = , \(q_{1} q_{2}\) = .
Click to check: Incorrect.
📗 [1 points] Two triangles are drawn from 4 vertices, \(\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} , \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} , \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} , \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}\), The first triangle has indices \(\left(0, 2, 1\right)\) and the second triangle has indices \(\left(2, 3, 1\right)\). Give the UV for each of the 4 vertices so that it shows the texture like the one on the right:
Use to apply the texture with the UV to the picture on the left.
📗 [1 points] Two triangles are drawn from 4 vertices, \(\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} , \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix} , \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} , \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}\), The first triangle has indices \(\left(0, 2, 1\right)\) and the second triangle has indices \(\left(2, 3, 1\right)\). Give the UV for each of the 4 vertices so that it shows the texture like the one on the right:
Use to apply the texture with the UV to the picture on the left.