Download presentation

Published byMegan Weaver Modified over 4 years ago

1
**Modeling Modeling is simply the process of creating 3D objects**

Many different processes to create models Many different representations of model data Once the models are obtained, one can transform them to the correct locations in space, place a virtual camera in space, and render a 2D image of the scene

2
**1 Polygonal Complex objects are broken down into many simple polygons**

Polygons form the “skin” of the object Objects are hollow Polygons have a front face and a back face

3
**Triangulation How are triangles obtained?**

Triangulating a set of surface points Several different triangulation approaches Delaunay triangulations attempt to equalize triangle angles (reduces long skinny triangles)

4
How Many Triangles? More triangles are needed in surface areas that require more geometric detail Higher curvature more triangles necessary

5
Level Of Detail (LOD) It can be very costly to always display an entire object at the greatest level of detail Less detail is necessary the farther away you are from on object Also depends on the viewing angle and screen size Solution: create several models of the object at different levels of detail Display the correct one for the viewing distance

6
LOD 50 Vertices 500 Vertices 2000 Vertices

7
**LOD How to create the same model in multiple levels of detail?**

Ex: start with most detailed, resample with less vertices, and then re-triangulate When to switch models when rendering? Based on distance and screen size Ex: 640x480 screen 307,200 pixels Object takes up half of screen 150K pixels Any more than 300K triangles (half are facing away from the camera) is overkill at this distance and screen size Visual artifacts can occur at switching point

8
**Creating the Surface Points**

Triangulation works on a set of points One needs to create this surface point set Many different approaches: Manual placement Mathematical (geometrical) generation Scanning real objects

9
**Mathematical Generation**

Solids of Revolution Rotation of a cross-section around an axis Spheres Cones Cylinders

10
**Mathematical Generation**

Extrusion Extrude a cross-section along a profile curve Scale may vary along the profile Many metal and plastic parts Cones Cylinders Bottles

11
**Scanning Real Objects Laser scanning Tomographic methods**

Scanning Real Objects Laser scanning Tomographic methods Medical scanning (Xray, CT, MRI) Radar Recovered 3D model Hand-held laser scanner Slice of brain from CT scan Recovered 3D model of lungs

12
**Triangle Representations**

Graphics cards do most of the triangle work Need an efficient way to send triangles to the card Some typical primitive triangle representations: Lists Fans Strips 1.6 vertices per triangle 1.5 vertices per triangle 3.0 vertices per triangle

13
**Constructive Solid Geometry**

Unlike polygonal approaches, CSG models are “solids” Polygonal models are “skins” Solid approaches are often better suited for medical applications because Cutting slices through objects Representing internal functional data

14
**CSG Trees CSG models are stored in trees Leaves are primitive shapes**

Spheres, Cubes, Cones, etc. Nodes are Boolean operations Union, Difference, Intersection

15
CSG Operations Primitives: Union: Intersection: Difference:

16
**CSG Rendering CSG models can be rendered by:**

Computing surface points and triangulating Rendering can then be performed by standard hardware Use of special CSG rendering routines Not hardware optimized

17
Representing Curves There are many different methods of representing general curves (rather than attempt to model all surfaces as some existing function, say a Sine or Cosine). The most common are: Cubic Splines Bezier Curves B-splines NURBS and -splines

18
Curve Fitting Find a simple formula that follows the trend of given discrete data points Allows positions in between data points to be calculated and drawn Satisfies a pre-specified amount of smoothness

19
**Curve Fitting Two approaches**

Interpolation – fit the discrete data points exactly Approximation – follow the trend of the data points closely, but satisfy other criteria, e.g. satisfy a pre-specified amount of smoothness

20
**Curve Fitting General approach**

build the curve fitting function from a restricted class of easily computed functions Usually polynomials of low degree Sine and cosine functions are common in theoretical curve fitting applications (e.g. smoothing of data), but in practice these may be computationally too expensive.

21
**Curve Fitting Parametric representation, parameter t**

Case of 2 control points P0 , P1 , P0 , P1 , may be points in 2D, or in 3D bi(t) are basis functions – fixed. bi(t) “blend” points P0 , P1

22
**Linear Interpolation Case of 2 control points P0 , P1 , parameter t**

b0(t)=1-t, b1(t)=t are the basis functions. Polynomial of degree 1 b0(t) + b1(t)= (1-t) + t = 1 for all t Q(t) : straight line join between P0 and P1

23
**Curve Fitting Parametric representation, parameter t**

P0 , P1 , P2 , P3 may be points in 2D, or in 3D bi(t) are basis functions – fixed. bi(t) “blend” points P0 , P1 , P2 , P3

24
**Curve Fitting Case of 4 control points P0 , P1 , P2 , P3 ,**

As t varies (e.g. between 0 and 1), Q(t) assumes different point values a weighted combination of P0 , P1 , P2 , P3 weights vary, via bi(t), with t

25
Curve Fitting Weights bi(t) are commonly chosen to be cubic polynomials in t Polynomial evaluation requires only arithmetic operations (+,-,*)

26
Curve Fitting A cubic polynomial has 4 coefficients, and can be determined from the data of 4 points. The cubic is the lowest degree polynomial that can accommodate a non-planar path (3 points define a plane, so need the 4th out of plane point)

27
**Interpolation vs. Approximation**

Given a set of n points, to create a curve we either interpolate the points (curve passes through all points) approximate the points (points describe convex hull of curve) Points on curve = knot points Points on convex hull (off curve) = control points Interpolate Approximate Control points Convex hull knot points

28
Splines If we have more than 4 points we require a polynomial of higher degree higher degree polynomials are more difficult to control they exhibit unwanted wiggles (oscillations) Quadratic Cubic Quartic Quintic

29
**Splines In general we use cubic polynomials for curves in CG:**

minimal wiggles and faster to compute than high degree polynomials lowest degree which allows non-planar curves (quadratics require 3 points, 3 points always lie in the same plane)

30
**Defining the Cubic Spline**

Normally we supply 4 points we wish the spline to pass through. If we have more than 4 points we must employ more than 1 spline use a piecewise cubic polynomial for n points, we have (n-1)/3 individual cubic segments without further constraints these will not join smoothly non-smooth smooth

31
**Piecewise Polynomial Curves**

Idea: Use different polynomial functions for different parts of the curve Advantage: Flexibility Local control Issue: Smoothness at “joints” (continuity)

32
Continuity Continuity Ck indicates adjacent curves have the same kth derivative at their joints

33
**C0 Continuity Adjacent curves share …**

Same endpoints: Qi(1) = Qi+1(0) Aside: discontinuous curves sometimes called “C-1”

34
**C1 Continuity Adjacent curves share … Same endpoints: Qi(1) = Qi+1(0)**

Same derivatives: Qi ’(1) = Qi+1 ’(0)

35
**C2 Continuity Adjacent curves share … Same endpoints: Qi(1) = Qi+1(0)**

Same derivatives: Qi ’(1) = Qi+1 ’(0) Same second derivatives: Qi ’’(1) = Qi+1 ’’(0)

36
**Examples of Continuity**

37
**Parametric Curves and Patches**

We will start be examining curves Bézier curves B-Spline curves Then we will expand to surface patches Bézier patches B-Spline patches

38
Curve Fitting The row matrix of polynomials can be written as

39
Curve Fitting and for Q(t), write

40
Curve Fitting Substitute:

41
Bézier Curves Pierre Bézier, a French designer, first used them in the 1960’s in the design of Renault car bodies. Same time de Casteljau (Citroen) Since, they have been heavily used by Adobe in their fonts as well as in graphic applications A Bézier curve is a parametric curve The function C(u) defines the curve points (x, y, z) as the parameter u varies through [0..1]

42
Bézier Cubics P0 P3 P1 P2

43
**Bézier Cubics For Bézier cubic curves,**

the coefficients aij are chosen for 4 properties Q(0)=P0 Q(1)=P3 Q’(0) is in the direction of P1 – P0 Q’(1) is in the direction of P3 – P2

44
Bézier Cubics Example P3 P1 P0 P2

45
Bézier Cubics Example P3 P1 P0 P2

46
Bézier Cubics Example P0 P1 P3 P2 P1 –P0 P2 –P3

47
Bézier Curves The blending functions make much more sense graphically

48
**Bézier Curves Due to the setup of the blending functions:**

The curve goes through the end points control points P0 and P3 The curve doesn’t go through the interior control points The interior control influence the curve The curve is pulled in the direction of the control point Moving a control point changes the shape of the entire curve (called global control)

49
Bézier - coefficients The 4x4 matrix coefficients are chosen to satisfy the above 4 properties:

50
**Bézier – Properties check**

at t=0: So, (property 1)

51
**Bézier – Properties check**

at t=1: So, (property 2)

52
**Note: Differentiation of the powers of t gives:**

53
**Bézier – Properties check**

first derivative (gradient, velocity) at t: where

54
**Bézier – Properties check**

first derivative (gradient, velocity) at t=0: So is in the direction of (property 3)

55
**Bézier – Properties check**

first derivative (gradient, velocity) at t=1: So is in the direction of (property 4)

56
Piecewise continuity Piecewise Bézier curves can be constructed to have C1 continuity, by ensuring the last two control points (2,3) of one segment first two control points (3,4) of next segment are in line.

57
Bézier Curves A Bézier Curve can only “curve” as much as its degree allows Degree 1 (linear) is a line Degree 2 (quadratic) can curve once Degree 3 (cubic) can curve twice The number of control points is always 1 larger than the degree

58
**Bézier Curves So what if you want a really “curvy” curve?**

You could increase the degree of the curve The downfall of this approach is that each control point has global control over the curve shape That is, changing a single control point will modify the shape of the entire curve (not great for modeling) High degree curves are “unstable” It is computationally expensive You could join multiple cubic curves together Each control point only has influence over its piece of the curve (local control w.r.t. the entire joined curve) Hardware can be optimized for cubic curves But, we must maintain continuity across the joins!

59
**Bézier Curves So how are we going to maintain continuity?**

Notice that the line between the first 2 control points specify the tangent of the curve at t=0 And the line between the last 2 control points specify the tangent of the curve at t=1

60
Bézier Curves So if we line up P2P3 with Q0Q1, then we have the same tangent at end t=1 point of curve P and t=0 point of curve Q

61
**Bézier Curves Continuity put into more formal terms:**

C0 continuity means the curve points vary smoothly That is, the curve is a set of connected points For our joined example, it means the two joined segments share the same endpoints P3 is the same point as Q0 C1 continuity means the curve’s first derivatives vary smoothly (plus C0 continuity) For our joined example, it means the tangents at the end endpoints must be the same (P2, P3, Q0, Q1 must form a line) And P0, P1 must form a line with the curve before it and Q2, Q3 must form a line with the curve after it all 4 control points are constrained to some extent

62
Bézier Curves C2 continuity means the curve’s second derivatives vary smoothly (plus C1 continuity) Second derivative corresponds to curvature For our joined example, it implies constrains on P1, P2, P3, Q0, Q1, and Q2 Plus P0, P1, and P2 are constrained from the curve before it and Q1, Q2, and Q3 are constrained from the curve after it Thus, although it can be achieved, there are so many constrains on the positions of the control points that joined cubic Bézier curves are almost never C2 continuous

63
**Bézier Curves Do we care about C2 continuity?**

Probably not for simple modeling But if the curve is being used to specify the path/orientation of a camera: Not C0 means the camera position jumps Not C1 means the camera’s orientation jumps Not C2 means the change in the camera’s orientation has sudden jumps

64
**Rendering Bezier Curves (1)**

Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages: Expensive to evaluate the curve at many points No easy way of knowing how fine to sample points, and maybe sampling rate must be different along curve No easy way to adapt. In particular, it is hard to measure the deviation of a line segment from the exact curve 11/19/02

65
**Rendering Bezier Curves (2)**

Recall that a Bezier curve lies entirely within the convex hull of its control vertices If the control vertices are nearly collinear, then the convex hull is a good approximation to the curve Also, a cubic Bezier curve can be broken into two shorter cubic Bezier curves that exactly cover the original curve This suggests a rendering algorithm: Keep breaking the curve into sub-curves Stop when the control points of each sub-curve are nearly collinear Draw the control polygon - the polygon formed by the control points 11/19/02 (

66
**B-Spline Curves B-Splines fix two major problems of Béziers:**

Global control of control points Relationship between degree of the curve and the number of control points This is achieved by letting the user specify any number of control points and automatically constructing a set of cubic curves that are C2 This is similar to a set of joined cubic Bézier curves Joined cubic Bézier curves can have any number of control points and are still cubic, and each control point only influences its local cubic curve But B-Splines are C2 and have no constraints on control point locations as joined cubic Bézier curves

67
**B-Spline Cubics For B-Spline cubic curves, (basis splines)**

the coefficients aij are chosen for 3 properties between adjacent segments

68
B-Spline Cubics B-Spline cubic curves achieve C2 continuity by sacrificing the interpolation at the end points. In fact, with control points only a segment between is drawn as t varies between 0 and 1, though its shape is influenced by as well.

69
B-Spline Cubics Control Points P0, P1, P2, P3 t=1 t=0

70
**B-Spline Cubics Control Points P0, P1, P2, P3 t=0 t=1**

Effect of moving P3

71
**B-Spline Cubics Control Points P1, P2, P3, P4 t=0 t=1**

Effect of adding P4

72
**B-Spline Cubics Control Points P0, P1, P2, P3, P4**

The curve has C2 continuity at the join point P2

73
**B-Splines - coefficients**

The 4x4 matrix coefficients are chosen to satisfy the above 3 properties:

74
**B-Splines – Properties check**

continuity at the join of Q and : So, (property 1) – P1, P2, P3 weighted towards P2

75
**B-Splines - coefficients**

Note: Differentiation of the powers of t gives:

76
**B-Splines – Properties check**

continuity at the join of Q and : So, (property 2) – slope is in the direction joining P1 to P3

77
**B-Splines – Properties check**

continuity at the join of Q and : So, (property 3) – acceleration is in the direction of (P3 – P2 ) – (P2 – P1 )

78
B-Spline Curves So just like with Bézier curves, we have control points (Pi) and blending functions (Bi(u)) However, a full B-Spline curve of M+1 control points is really made up of M-2 curve segments, each being controlled by 4 of the control points Also, the blending functions are defined differently than with Bézier curves, with the two most popular variations being: Uniform Non-Uniform

79
**Uniform B-Spline Curves**

Uniform blending functions get their name from the fact that all the blending functions are uniform

80
**Uniform B-Spline Curves**

Recall that each curve segment composing the full B-Spline needs 4 control points modified by 4 blending functions This implies that only the section in yellow on the previous slide can be used to define the curve At either end there are not enough blending functions This also implies that the curve will not go through any of the control points, including the first and last (as was the case with Bézier) There are multiple non-zero blending functions at t=0 and t=1

81
Rational Curves A rational curve is a curve defined in 4D space that is then projected into 3D space The main point of using rational curves is that it allows you to define weights on the control points Giving a control point a higher weight causes the curve to be pulled more towards that control point One can have Rational Bézier curves or Rational B-Spline curves Or other types of curves not covered (Hermite, etc.)

82
Parametric Patches Parametric patches are used to model smooth curved surfaces and to allow dynamic control over the shape of the surface Parametric patches are uses heavily in CAD application and animation Currently real-time applications are dominated by triangle meshes Patches hold many advantages over triangle meshes and if hardware support for them becomes widespread there could be a major shift to them

83
Rendering Patches To have proper lighting we also need normals for the triangles We can simply use the triangles normal Or, if we want to be more accurate, we can use the actual normal to the parametric surface Partial derivative in the u direction is 1st tangent Partial derivative in the v direction is 2nd tangent Take their cross product and normalize to produce the normal vector

84
Parametric Patches One of the first uses of parametric patches is the “Utah Teapot” The actual teapot is on the left

85
**Polygonal Representation**

86
**Polygonal Representation**

87
Rendered

88
Patches To represent a surface, the concept of “curve” needs to be generalised. We can construct a sequence of slowly changing curves, each displaced from the previous one in a 3D setting.

89
Patches In terms of the present work, we can construct a curve from its control points. To generate a surface, we place side by side the sequence of curves. Each curve in the sequence will have slightly different control points. We can arrange the displaced control points themselves to lie on a curve, itself generated from another set of control points!

90
Bézier Patches 1 patch, 4x4 controls Evaluation: coarse

91
Bézier Patches 1 patch, 4x4 controls Evaluation: fine

92
Bézier Patches

93
Bézier Patches

94
Bézier Patches

95
Bézier Patches

96
Bézier Patches

97
Bézier Patches The following is an example of the control point lattice:

98
Bézier Patches The surface that is created is based on the control points:

99
**Bézier Patches The surface is based on Bézier curves**

Thus, the surface only matches the control points at the 4 corners

100
Bézier Patches Approach: for a single curve, make the control points Pi variable depend on another parameter, u in [0,1], say : Pi (u). In this way, obtain a new (displaced) curve for each u. Thus, for u=0, ¼, …1, ...

101
**Bézier Patches Generally:**

Express the variability of itself as a Bézier curve: by introducing 4 control points for each control point function Pi (u),

102
Bézier Patches In total, we need 4x4 control points. We specify the control functions in matrix form:

103
Bézier Patches Thus: Now substitute the matrix expression for P0(u) .. P3(u) :

104
Bézier Patches Bézier Patches This has the form: T where

105
**Bézier Patches An explicit form of is obtained by expressing**

in polynomial form: T 2 3 1 T u u 2 1 -1 -3 3 -6 u 3 where B =

106
Bézier Patches Thus T 1 T u 2 3 u 2 u 3

107
Bézier Polynomials For reference: T = =

108
**Bézier Patches All the same issue occur with patches as with curves**

Adjusting the control points changes the shape of the surface: All the same issue occur with patches as with curves Control points have global control Increasing the number of control points will increase the degree of the patch

109
Bézier Patches Thus, we handle large curvy surfaces the same was as with curves: join patches together Recall the continuity constrains: C0 continuity: edges must match C1 continuity: colinear control points More difficult near joins of 4 patches

110
Midpoint Subdivision Repeatedly join midpoints to find new control vertices Do it first for each row of original control points: 4x4 -> 4x7 Then do it for each column of new control points:4x7 -> 7x7

111
**A Potential Problem One (good) way to subdivide, is:**

If a control mesh is flat enough – draw it Else, subdivide into 4 sub-patches and recurse on each Problem: Neighbouring patches may not be subdivided to the same level Cracks can appear because join edges have different control meshes This can be fixed by adding extra edges Crack

112
**Convex Hull property Ideally, we want the “weights” of to be**

between 0 and 1 sum to 1 Then the points will not lie outside the inter-joins of points , that is, be contained in their convex hull.

113
Convex Hull property P1 P2 P3 P0

114
**Convex Hull property Convex hull of P0 P3 P1 P2**

See this as 2D or 3D, as appropriate

115
**Convex Hull property Holds for Bézier curves See Bézier Polynomials**

Holds for B-Splines Proved similarly.

116
**B-Splines – outline sum of weights**

Note. From we also obtain:

117
**B-Splines – outline sum of weights**

= = = 1

118
B-Spline Patches B-Spline patches are similar to Bézier patches except that they are based on B-Spline curves This implies that: You can have any number of control points in either the u or v direction (4x4, 8x12, etc.) and still maintain piecewise C2 cubic patches With Uniform patches, the patch is will no go through the control points

119
**Rendering Patches There are two types of ways we can render patches:**

Render them directly from the parametric descriptions in hardware Must have hardware support Approximate the patch with a triangle mesh and render this mesh Usually done in software Standard pipeline can be used

120
Rendering Patches To approximate the patch with triangles, we can use a uniform subdivision Evaluate the surface at fixed (u,v) intervals and connect the points with triangle strips

121
**Rendering Patches Or we can use an adaptive subdivision Pros: Cons:**

Divide surface in quarters If approximation patch is “flat enough” relative to the actual surface patch, then draw it Otherwise, repeat the sub-division on that quarter Pros: More triangles are generated where the curvature is high, less triangles where curvature is low Cons: Problems with cracks Neighbors not subdivided to the same level Can be fixed by adding more edges

122
How to Choose a Spline Hermite curves are good for single segments where you know the parametric derivative or want easy control of it Bezier curves are good for single segments or patches where a user controls the points B-splines are good for large continuous curves and surfaces NURBS are the most general, and are good when that generality is useful, or when conic sections must be accurately represented (CAD)

Similar presentations

OK

Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.

Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Download ppt on recruitment and selection process of infosys Ppt on national education day in india Ppt on director identification number Ppt on models of business communication Ppt on online banking project in java Ppt on personality development and communication skills Ppt on power quality problems Download ppt on pulse code modulation math Ppt on wireless integrated network sensors Ppt on cross sectional analysis of financial statement information