1 / 33

CS 551/651 Advanced Graphics

CS 551/651 Advanced Graphics. Technical Background. FLTK. Hopefully you downloaded and compiled successfully Questions Assignment 1 – Warmup Interactive B-Spline Editor Due two weeks from today. Topics you should know. Object, world, camera coord spaces

Download Presentation

CS 551/651 Advanced Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 551/651Advanced Graphics Technical Background

  2. FLTK • Hopefully you downloaded and compiled successfully • Questions • Assignment 1 – Warmup • Interactive B-Spline Editor • Due two weeks from today

  3. Topics you should know • Object, world, camera coord spaces • Lookat point, up vector, angle of view, near/far clipping planes, view frustum • Homogeneous coords • Transformation matrices • Rendering pipeline

  4. Affine Transformations • A transformation that preserves • Angles • Lengths • Parallel lines • Ex • Translation • Rotation • Scaling • Reflection • Shear

  5. x z Round-off Errors • Consider rotating a polygonal model about y-axis • Moon = Roty(5) Moon • Moon = Roty(5) Roty(5) Moon • Moon = Roty(n) Moon

  6. Orthonormalization • All rows of transformation matrix must: • Have unit length • Be orthogonal to one another • Row1 dot Row2 = 0 • One technique to orthonormalize • Normalize row 1 (excluding last column) • Row1 x Row2 = Row3 (normalize) • Row3 x Row1 = Row2 (normalize) • Errors were shifted in matrix

  7. Rotations • Give me four rotation representations and their shortcomings… • 3x3 matrix • Euler Angles • Axis-angle • Quaternion - Interpolation - Gimbal Lock - Compiling Rot Seqs

  8. Representing 3 Rotational DOFs • 3x3 Matrix (9 DOFs) • Rows of matrix define orthogonal axes • Euler Angles (3 DOFs) • Rot x + Rot y + Rot z • Axis-angle (4 DOFs) • Axis of rotation + Rotation amount • Quaternion (4 DOFs) • 4 dimensional complex numbers

  9. Rotation Matrix • 9 DOFs must reduce to 3 • Rows must be unit length (-3 DOFs) • Rows must be orthogonal (-3 DOFs) • Drifting matrices is very bad • Numerical errors results when trying to gradually rotate matrix by adding derivatives • Resulting matrix may scale / shear • Gram-Schmidt algorithm will re-orthogonalize your matrix • Difficult to interpolate between matrices

  10. Euler Angles • (qx, qy, qz) = RzRyRx • Rotate qx degrees about x-axis • Rotate qy degrees about y-axis • Rotate qz degrees about z-axis • Axis order is not defined • (y, z, x), (x, z, y), (z, y, x)… are all legal • Pick one

  11. Euler Angles • Rotations not uniquely defined • ex: (z, x, y) = (90, 45, 45) = (45, 0, -45)takes positive x-axis to (1, 1, 1) • cartesian coordinates are independent of one another, but Euler angles are not • Gimbal Lock • Term derived from mechanical problem that arises in gimbal mechanism that supports a compass or a gyro

  12. Gimbal Lock

  13. Gimbal Lock • Occurs when two axes are aligned • Second and third rotations have effect of transforming earlier rotations • ex: Rot x, Rot y, Rot z • If Rot y = 90 degrees, Rot z == -Rot x

  14. Interpolation • Interpolation between two Euler angles is not unique • ex: (x, y, z) rotation • (0, 0, 0) to (180, 0, 0) vs. (0, 0, 0) to (0, 180, 180) • Interpolation about different axes are not independent

  15. Interpolation

  16. Chapter 3Interpolation • First let’s talk about functions • Read Appendix B.4 • Explicit equation: y = f(x) • Dependent on choice of coordinate axes • Not defined if more than one f(x) for x, sqrt(9) • Implicit equation: f(x, y) = 0 • Quick to see if (x,y) is on curve • Difficult to generate series of f(x) for x:0g10 • Parametric: x = f(t), y = f(t)

  17. Equations • Polynomial: only containing variables raised to a power • Linear, quadratic, cubic: polynomial equation with highest power of 1, 2, 3 • Transcendental: equations containing trig functions, logs, exponentials

  18. Continuity • Zeroth-order (C0): the value of the function f(x0) is arbitrarily close to the value of f(x0+e) • First-order (C1): first derivative is continous • Second-order (C2): second derivative is continuous

  19. Piecewise Curve Segments • One curve constructed by connecting many smaller segments end-to-end • Piecewise linear: a sequence of straight line segments • Continuity describes the joint

  20. Specifying Curves • Control Points • A set of points that influence the curve’s shape • Knots • Control points that lie on the curve • Interpolating Splines • Curves that pass through the control points (knots) • Approximating Splines • Control points merely influence shape

  21. Linear Interpolation P1 or For generic blending functions: P(u) P0 Matrix forms:

  22. Interpolation Functions • Hermite • Bezier • B-spline • Global vs. local control

  23. Animating with Interpolation • Most variables are controlled with parametric equations • x-position, y-position, z-position • x-, y-, z- rotation axis, rotation angle • Size, color, texture… • Most parametric equations are constructed from key frames

  24. Motion Along a Curve • Equal increments in interpolation parameter result in unequal jumps in function space Dt Dt f(t) t

  25. Arc Length • Arc length is the distance along the curve • To ensure constant speed of curve evaluation, perform arc length parameterization of curve • Compute a mapping offline of arc length values to parameter values • Analytically compute arc length

  26. Arc Length • Given parameters u1 and u2, find LENGTH(u1, u2) • Given an arc with length s and a parameter u1, find u2 s.t. LENGTH(u1, u2) is s • Can we compute s = G(u) = distance from start of curve to point at u? • If so, G-1 is used to build arc length parameterized curve: P(G-1(s))

  27. Analytic Computation Cubic curve example:

  28. Forward Differencing • Sample curve a many parameter values • Create piecewise linear representation of curve from parameter evaluations • Compute linear distance between samples • Store distances in table • Limitations/Shortcomings?

  29. Adaptive Approach • Adaptively subdivide • First step, compare: • length (start, middle) + length (middle, end) • length (start, end) • If error is too large, subdivide • Use link list to store data

  30. Numerical Computation • Numerical methods exist to approximate integral of curve given sample points/derivatives • Instead of using sum of linear segments, use numerical method to compute sum of curved segments

  31. Gaussian Quadrature • Computes the arc length of a cubic curve • Adaptive gaussian integration monitors errors to subsample • Build a table that maps parameter values to arc length values • To solve arc length at u, find ui and ui+1that bound u • Use gaussian quadrature to compute intermediate arc length between that at uiand ui+1

  32. Gaussian Quadrature • Compute u s.t. length (u1, u) = s • Solve: s – length(u1, u) = 0 • Newton-Raphson does this for us: • f = s – length(u1, pn-1) f’= dp/du evaluated at pn-1

  33. Newton-Raphson • Be aware that Newton-Raphson could set pn to a value not defined by curve • f’(pn-1) could be 0 (divide by 0)

More Related