Download presentation
Presentation is loading. Please wait.
Published byLynette Preston Modified over 9 years ago
1
Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005
2
Final The final is on Tuesday, December 6 From 11:30-2:30 Center Hall, room 105 It will cover material from the entire quarter It will be similar to the midterm, but with 20 questions There will not be any questions on C++ or OpenGL
3
Topics The final will have geometry problems similar to those in the midterm There will be some mathematical questions about curved surfaces and ray tracing (lectures 12, 13, & 16) I suggest studying lectures 12, 13 & 16 well, as I might ask about anything from those (you don’t have to memorize the Fresnel equations, but you should know what they are for) There will not be any math questions about BRDFs, the ‘Rendering Equation’, or global illumination, but I expect you to be familiar with the concepts of these things There will be conceptual questions about scene management and modeling There will also be mathematical and conceptual questions from things covered in the first half of the class (traditional graphics pipeline)
4
Example: Distance to Plane A plane is described by a point p on the plane and a unit normal n. Find the distance from point x to the plane p n x
5
Example: Distance to Plane The distance is the length of the projection of x-p onto n: p n x x-p
6
Example: Target ‘Lock On’ For an airplane to get a missile locked on, the target must be within a 10 degree cone in front of the plane. If the plane’s matrix is M and the target position is t, find an expression that determines if the plane can get a lock on. M t
7
Example: Target ‘Lock On’ For an airplane to get a missile locked on, the target must be within a 10 degree cone in front of the plane. If the plane’s matrix is M and the target position is t, find an expression that determines if the plane can get a lock on. a b c d t
8
Example: Target ‘Lock On’ We want to check the angle between the heading vector (-c) and the vector from d to t: We can speed that up by comparing the cosine instead ( cos(10°)=.985 )
9
Example: Target ‘Lock On’ We can even speed that up further by removing the division and the square root in the magnitude computation: All together, this requires 8 multiplications and 8 adds
10
Example: Camera ‘Look At’ Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M.
11
Example: Camera ‘Look At’ Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M. Two possible approaches include: Measure angles and rotate matrix into place Construct a,b,c, & d vectors of M directly
12
Example: Camera ‘Look At’ Method 1: Measure Angles & Rotate Measure Angles: Tilt angle Heading angle Position Construct matrix by starting with the identity, then apply tilt and heading rotations
13
Example: Camera ‘Look At’ Method 2: Build Matrix Directly The d vector is just the position of the camera, which is e: The c vector is a unit length vector that points directly behind the viewer:
14
Example: Camera ‘Look At’ Method 2: Build Matrix Directly The a vector is a unit length vector that points to the right of the viewer. It is perpendicular to the c axis. To keep the camera from rolling, we also want the a vector to lay flat in the xz-plane, perpendicular to the y-axis. Note that a cross product with the y-axis can be optimized as follows:
15
Example: Camera ‘Look At’ Method 2: Build Matrix Directly The b vector is a unit length vector that points up relative to the viewer. It is perpendicular to the both the c and a axes Note that b does not need to be normalized because it is already unit length. This is because a and c are unit length vectors 90 degrees apart.
16
Example: Camera ‘Look At’ Method 2: Build Matrix Directly Summary:
17
Position Vector Dot Matrix
18
v=(.5,.5,0,1) x y Local Space (0,0,0)
19
Position Vector Dot Matrix v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d Matrix M
20
Position Vector Dot Matrix v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d v’v’
21
Position vs. Direction Vectors Vectors representing a position in 3D space are expanded into 4D as: Vectors representing direction are expanded as:
22
Direction Vector Dot Matrix
23
The abcd vectors of M’ are the abcd vectors of M transformed by matrix N Notice that a, b, and c transform as direction vectors and d transforms as a position Matrix Dot Matrix
24
Identity Take one more look at the identity matrix It’s a axis lines up with x, b lines up with y, and c lines up with z Position d is at the origin Therefore, it represents a transformation with no rotation or translation
25
Linear Interpolation Linear interpolation (Lerp) is a common technique for generating a new value that is somewhere in between two other values A ‘value’ could be a number, vector, color, or even something more complex like an entire 3D object… Consider interpolating between two points a and b by some parameter t a b t=1.. 0<t<1 t=0
26
de Casteljau Algorithm p0p0 p1p1 p2p2 p3p3 We start with our original set of points In the case of a cubic Bezier curve, we start with four points
27
de Casteljau Algorithm p0p0 q0q0 p1p1 p2p2 p3p3 q2q2 q1q1
28
q0q0 q2q2 q1q1 r1r1 r0r0
29
r1r1 x r0r0
30
Bezier Curve x p0p0 p1p1 p2p2 p3p3
31
Recursive Linear Interpolation
32
Expanding the Lerps
33
Bernstein Polynomials
34
The Bernstein polynomial form of a Bezier curve is where and Bernstein Polynomials
35
B33B33 B03B03 B13B13 B23B23
36
Cubic Equation Form
37
Cubic Matrix Form
39
Matrix Form
40
Bezier Curves & Cubic Curves By adjusting the 4 control points of a cubic Bezier curve, we can represent any cubic curve Likewise, any cubic curve can be represented uniquely by a cubic Bezier curve There is a one-to-one mapping between the 4 Bezier control points (p 0,p 1,p 2,p 3 ) and the pure cubic coefficients (a,b,c,d) The Bezier basis matrix B Bez (and it’s inverse) perform this mapping There are other common forms of cubic curves that also retain this property (Hermite, Catmull-Rom, B-Spline)
41
Derivatives Finding the derivative (tangent) of a curve is easy:
42
Tangents The derivative of a curve represents the tangent vector to the curve at some point
43
Convex Hull Property If we take all of the control points for a Bezier curve and construct a convex polygon around them, we have the convex hull of the curve An important property of Bezier curves is that every point on the curve itself will be somewhere within the convex hull of the control points p0p0 p1p1 p2p2 p3p3
44
Continuity A cubic curve defined for t ranging from 0 to 1 will form a single continuous curve and not have any gaps We say that it has geometric continuity, or C 0 continuity We can easily see that the first derivative will be a continuous quadratic function and the second derivative will be a continuous linear function The third derivative (and all others) are continuous as well, but in a trivial way (constant), so we generally just say that a cubic curve has second derivative continuity or C 2 continuity In general, the higher the continuity value, the ‘smoother’ the curve will be, although it’s actually a little more complicated than that…
45
Interpolation / Approximation We say that cubic Bezier curves interpolate the two endpoints (p 0 & p 3 ), but only approximate the interior points (p 1 & p 2 ) In geometric design applications, it is often desirable to be able to make a single curve that interpolates through several points
46
Piecewise Curves Rather than use a very high degree curve to interpolate a large number of points, it is more common to break the curve up into several simple curves For example, a large complex curve could be broken into cubic curves, and would therefore be a piecewise cubic curve For the entire curve to look smooth and continuous, it is necessary to maintain C 1 continuity across segments, meaning that the position and tangents must match at the endpoints For smoother looking curves, it is best to maintain the C 2 continuity as well
47
Connecting Bezier Curves A simple way to make larger curves is to connect up Bezier curves Consider two Bezier curves defined by p 0 …p 3 and v 0 …v 3 If p 3 =v 0, then they will have C 0 continuity If (p 3 -p 2 )=(v 1 -v 0 ), then they will have C 1 continuity C 2 continuity is more difficult… p0p0 p0p0 p1p1 p2p2 P3P3 P3P3 p2p2 p1p1 v0v0 v1v1 v2v2 v3v3 v3v3 v2v2 v1v1 v0v0 C 0 continuity C 1 continuity
48
Bezier Surfaces Bezier surfaces are a straightforward extension to Bezier curves Instead of the curve being parameterized by a single variable t, we use two variables, s and t By definition, we choose to have s and t range from 0 to 1 and we say that an s-tangent crossed with a t-tangent will represent the normal for the front of the surface s t 0,0 1,1 1,0 0,1 n
49
Curved Surfaces The Bezier surface is a type of parametric surface A parametric surface is a surface that can be parametrized by two variables, s and t Parametric surfaces have a rectangular topology In computer graphics, parametric surfaces are sometimes called patches, curved surfaces, or just surfaces There are also some non-parametric surfaces used in computer graphics, but we won’t consider those now
50
Control Mesh Consider a bicubic Bezier surface (bicubic means that it is a cubic function in both the s and t parameters) A cubic curve has 4 control points, and a bicubic surface has a grid of 4x4 control points, p 0 through p 15 p0p0 p1p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 p9p9 p 10 p 11 p 12 p 13 p 14 p 15 s t
51
Surface Evaluation The bicubic surface can be thought of as 4 curves along the s parameter (or alternately as 4 curves along the t parameter) To compute the location of the surface for some (s,t) pair, we can first solve each of the 4 s-curves for the specified value of s Those 4 points now make up a new curve which we evaluate at t Alternately, if we first solve the 4 t-curves and to create a new curve which we then evaluate at s, we will get the exact same answer This gives a pretty straightforward way to implement smooth surfaces with little more than what is needed to implement curves s t (0.2, 0.6)
52
Matrix Form We saw the matrix form for a 3D Bezier curve is
53
Matrix Form To simplify notation for surfaces, we will define a matrix equation for each of the x, y, and z components, instead of combining them into a single equation as for curves For example, to evaluate the x component of a Bezier curve, we can use:
54
Matrix Form To evaluate the x component of 4 curves simultaneously, we can combine 4 curves into a 4x4 matrix To evaluate a surface, we evaluate the 4 curves, and use them to make a new curve which is then evaluated This can be written in a compact matrix form:
55
Matrix Form
56
C x stores the coefficients of the bicubic equation for x G x stores the geometry (x components of the control points) B Bez is the basis matrix (Bezier basis) s and t are the vectors formed from the exponents of s and t The matrix form is a nice and compact notation and leads to an efficient method of computation It can also take advantage of 4x4 matrix support which is built into modern graphics hardware
57
Tangents To compute the s and t tangent vectors at some (s,t) location, we can use:
58
Normals To compute the normal of the surface at some location (s,t), we compute the two tangents at that location and then take their cross product Usually, it is normalized as well s t n x
59
Bezier Surface Properties Like Bezier curves, Bezier surfaces retain the convex hull property, so that any point on the actual surface will fall within the convex hull of the control points With Bezier curves, the curve will interpolate (pass through) the first and last control points, but will only approximate the other control points With Bezier surfaces, the 4 corners will interpolate, and the other 12 points in the control mesh are only approximated The 4 boundaries of the Bezier surface are just Bezier curves defined by the points on the edges of the surface By matching these points, two Bezier surfaces can be connected precisely
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.