9.
Setting vertex properties examplesSunday, December 9, 12
10.
Homogeneous coordinates Internally, the OpenGL implementation always converts it into a 4D ﬂoating-point number. It’s an artiﬁcial construction that allows all transformations to be represented with matrix multiplication. These 4D coordinates are known as homogeneous coordinates. So, shortly after entering the assembly line, all vertex positions become 4D; don’t they need to become 2D at some point? The answer is yes.Sunday, December 9, 12
11.
The Life of a Vertex Perspective transform ( removal of w )Sunday, December 9, 12
12.
Vertex goes from 4D to 2D Early life of a vertex. Top row is conceptual; bottom row is OpenGL’s viewSunday, December 9, 12
13.
Vertex goes from 4D to 2DSunday, December 9, 12
14.
The photography metaphor 1. Arrange the various dishes on the table. 2. Arrange one or more light sources. 3. Position the camera. 4. Aim the camera toward the food. 5. Adjust the zoom lens. 6. Snap the picture. 1. Adjust the camera’s ﬁeld-of-view angle. (projection matrix) 2. Position the camera and aim it in the appropriate direction. (view matrix) 3. For each object: a. Scale, rotate, and translate. (model matrix) b. Render the object.Sunday, December 9, 12
17.
Model Matrix The three most common operations when positioning an object in a scene Scale Translation RotationSunday, December 9, 12
18.
Setting the Model Matrix (Scale)Sunday, December 9, 12
19.
Setting the Model Matrix (Scale)Sunday, December 9, 12
20.
Setting the Model Matrix (Translation)Sunday, December 9, 12
21.
Setting the Model Matrix (Translation)Sunday, December 9, 12
22.
Setting the Model Matrix (Rotation ES 1.1) glRotatef(m_currentAngle, 0, 0, 1); counter-clockwise rotation about the Z-axis angle in degrees the latter three arguments deﬁne the axis of rotationSunday, December 9, 12
23.
Setting the Model Matrix (Rotation ES 2.0)Sunday, December 9, 12
24.
Setting the Model Matrix (Rotation) arbitrary axis rotation * ES 1.1 glRotatef generates the matrix for you glRotatef only rotates about the originSunday, December 9, 12
25.
Setting the Model Matrix (Rotation) arbitrary axis rotation * ES 2.0Sunday, December 9, 12
26.
What we have been throughSunday, December 9, 12
27.
Setting the View TransformSunday, December 9, 12
28.
Setting the View Transform The simplest way to create a view matrixSunday, December 9, 12
29.
Setting the Projection Transform think of the projection as being the cameras "zoom lens"Sunday, December 9, 12
30.
Setting the Projection Transform ES 1.1Sunday, December 9, 12
31.
Setting the Projection Transform Perspective Orthographic ES 2.0Sunday, December 9, 12
36.
Example of easing equationsSunday, December 9, 12
37.
Quaternions For position keyframes and color keyframes Its easy What if interpolating between two orientations?Sunday, December 9, 12
38.
Quaternions Storing an angle for each joint would be insufﬁcient youd also need the axis of rotation This is known as Axis-Angle notation requires a total of four ﬂoating-point values for each jointSunday, December 9, 12
39.
Quaternions Storing an angle for each joint would be insufﬁcient youd also need the axis of rotation Quaternions This is known as Axis-Angle notation requires a total of four ﬂoating-point values for each jointSunday, December 9, 12
40.
Quaternions Storing an angle for each joint would be insufﬁcient Study of rotation youd also need the axis and This is understand it!! known as Axis-Angle notation requires a total of four ﬂoating-point values for each jointSunday, December 9, 12
41.
Vector Beautiﬁcation template <typename T> Vector3 Cross(const Vector3& v) const struct Vector3 { { return Vector3(y * v.z - z * v.y, Vector3() {} z * v.x - x * v.z, Vector3(T x, T y, T z) : x(x), y(y), z(z) {} x * v.y - y * v.x); void Normalize() } { T Dot(const Vector3& v) const ﬂoat length = std::sqrt(x * x + y * y + z * z); { x /= length; return x * v.x + y * v.y + z * v.z; y /= length; } z /= length; Vector3 operator-() const } { return Vector3(-x, -y, -z); Vector3 Normalized() const } { Vector3 v = *this; bool operator==(const Vector3& v) const v.Normalize(); { return v; return x == v.x && y == v.y && z == v.z; } } T x; T y; T z; };Sunday, December 9, 12
42.
Vector Beautiﬁcation vec3 z; normalize(&z, &(eye-target)); vec3 cross; vec3 z = (eye - target).Normalized(); cross(&cross, &up, &z); vec3 x; vec3 x = up.Cross(z).Normalized(); normalize(&x, &cross); vec3 y = z.Cross(x).Normalized(); cross(&cross, &up, &z); vec3 y; normalize(&y, &cross);Sunday, December 9, 12
43.
Hello Cone Fixed FunctionSunday, December 9, 12
Be the first to comment