UNIT - 4 3D concepts and object representation 1.

Slides:



Advertisements
Similar presentations
Lecture Notes #11 Curves and Surfaces II
Advertisements

2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Lecture 10 Curves and Surfaces I
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
ICS 415 Computer Graphics Bézier Splines (Chapter 8)
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
Dr. S.M. Malaek Assistant: M. Younesi
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
1 Computer Graphics Chapter 7 3D Object Modeling.
Curves Chiew-Lan Tai.
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Modelling: Curves Week 11, Wed Mar 23
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Chapter 10: Curves and Surfaces Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
Splines III – Bézier Curves
Modeling and representation 1 – comparative review and polygon mesh models 2.1 Introduction 2.2 Polygonal representation of three-dimensional objects 2.3.
Curves and Surfaces (cont’) Amy Zhang. Conversion between Representations  Example: Convert a curve from a cubic B-spline curve to the Bézier form:
Curve Modeling Bézier Curves
CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
Curve Modeling B-Spline Curves
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
Spline Representations
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Curves and Surfaces Chapter 10. CS 480/680 2Chapter 9 -- Hierarchical Models Introduction: Introduction: Until now we have worked with flat entities such.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
Keyframing and Splines Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
In the name of God Computer Graphics Bastanfard. Curve Function(2) Other method is approximate it using a poly-line. Just locate a set of points along.
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
Computing & Information Sciences Kansas State University Lecture 31 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 32 of 42 Wednesday, 11.
11/26/02(C) University of Wisconsin Last Time BSplines.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
Introduction to Curves
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:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
3D Object Representations. Introduction Line and circle and polygon algorithms- represented simple and smooth object. Some Natural object are neither.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Surfaces and Curves.
Curve & Surface.
(Spline, Bezier, B-Spline)
Chapter 10-2: Curves.
CURVES CAD/CAM/CAE.
© University of Wisconsin, CS559 Spring 2004
UNIT-5 Curves and Surfaces.
Three-Dimensional Object Representation
Introduction to Parametric Curve and Surface Modeling
Spline representation. ❖ A spline is a flexible strip used to produce a smooth curve through a designated set of points. ❖ Mathematically describe such.
Presentation transcript:

UNIT - 4 3D concepts and object representation 1

Introduction : Up to here we have seen that how lines, circle, ellipse, characters etc can be drawn. In this unit, we will study the polygon representation methods – these methods are quite important because it’s the polygon that constitutes every closed object like tree, clouds, ball, car, etc., to be represented through graphics. Further, each polygon has its own mathematical equation which works as the generating function for that polygon. 2

It’s the Bezier curves which have revolutionized the field of computer graphics and opened a new arena, i.e., automobile sector, for analysis and designing of automobiles. Inspired with this achievement, scientists have worked hard and now there is no area which is complete without computer graphics and animation. In this unit, we will deal with fitting curves to the digitized data. Two techniques are available for obtaining such curves cubic spline and parabolicaly blended curves. 3

1.1 3D display methods, Polygon and quadric surfaces provide precise description for simple Euclidean objects like polyhedrons, ellipsoids. Spline surfaces and construction techniques are useful for designing aircraft wings, gears, and other engineering structures with curved surfaces Procedural methods such as fractals constructions and particle systems give us accurate representations for the natural objects like clouds, trees etc. Physically based modeling methods using systems for interacting forces can be used to describe the non-rigid behaviors of piece of jelly, or a piece of cloth. Octrees encoding are used to represent internal features of the objects, such as those obtained from medical CT images, volume renderings and other visualization techniques. 4

The representational schemes of solid objects are divided into two broad categories: Boundary representations: Here the 3D object is represented as a set of surfaces that separate the object interior from the environment. Examples are polygonal facets and spline patches. For better understanding consider Figure 1. Figure 1 5

Space partitioning representations: These are used to describe the interior properties, by partitioning the spatial regions containing an object into a set of small non- overlapping contiguous solids (usually cubes). Example: Octree (which is the space partitioning description of 3D object). For a better understanding consider Figure 2. 6

1.1.1 Polygon Surfaces From Figure 1 and Figure 2 it is quite clear that it is possible to store object’s description as a set of surface polygons and the same is actually done by many graphic systems, actually this way of object description fastens the rendering and display of object surfaces. The approach is beneficial because all the surfaces can now be described with linear equations and hence polygonal description of the surfaces is referred as “standard graphic objects”. 7

Consider Figure 3 where the cylindrical surface is represented as a mesh of polygons. The representation is known as wire frame representation which can quickly describe the surface structure. On the basis of the structure a realistic rendering can be performed by interpolating the shading patterns across the polygon surfaces. Thus polygon mesh representation of the curved surface is actually dividing a curved surface into polygon facets. This improves and simplifies the process of rendering (transforming a 3D scene to 2D scene with least loss of information like height, depth etc). 8

Now the objects are composed of standard graphic objects (polygon surfaces). Each graphic object needs some method for its description which could be a polygon table or equation etc. 9

1.1.2 Polygon Tables Every polygon is analogous to a graph G(V,E). So we can say that a polygon surface can be specified with as a set of vertex coordinates and associated attribute parameters (the attributes may be color, contrast, shading, etc). Most systems use tables to store the information entered for each polygon, and it’s the data in these tables which is then used for subsequent processing, display and manipulation of the objects in the scene. 10

Polygon data tables can be organized into two groups: Attribute tables: This table holds object information like transparency, surface reflexivity, texture characteristics, etc., of an object in the scene. Geometric tables: This table stores the information of vertex coordinates and parameters like slope for each edge, etc. To identify the spatial orientation of polygon surface. In order to store geometric information of a polygon properly, this table is further bifurcated into three more tables: 11

In order to store geometric information of a polygon properly, this table is further bifurcated into three more tables: a) Vertex table: Holds coordinate values of vertices in the object. b) Edge table: Holds pointers back in to the vertex table for identification of the vertices related to each polygon edge. c) Polygon table or polygon surface table: Holds pointers back into the edge table for identification of the edges related to the polygon surface under construction. 12

13

Some basic tests that should be performed before producing a polygon surface by any graphic package: 1) every vertex is listed as an endpoint for at least two edges, 2) every edge is part of at least one polygon, 3) every polygon is closed, 4) each polygon has at least one shared edge, 5) if the edge table contains pointer to polygons, every edge referenced by a polygon pointer to polygon, every edge referenced by a polygon pointer has a reciprocal pointer back to polygon. 14

Polygon Tables 15 Vertex Table Edge Table Surface Table E1E1 E2E2 E4E4 E3E3 E5E5 E6E6 V1V1 V5V5 V3V3 V2V2 V4V4 VERTEX TABLE V1x1,y1,z1 V2x2,y2,z2 V3x3,y3,z3 V4x4,y4,z4 V5x5,y5,z5 POLYGON-SURFACE TABLE S1E1,E2,E3 S2E3,E4,E5,E6 EDGE TABLE E1V1,V2 E2V2,V3 E3V3,V1 E4V3,V4 E5V4,V5 E6V5,V1

1.1.3 Plane Equation Plane is a polygonal surface, which bisects its environment into two halves. One is referred to as forward and the other as backward half of any plane. Now the question is, which half is forward and which backward, because both are relative terms. So we consider any point on the plane should satisfy the equation of a plane to be zero, i.e., Ax + By + Cz + D=0. This equation means any point (x,y,z) will only lie on the plane if it satisfies the equation to be zero any point (x,y,z) will lie on the front of the plane if it satisfies the equation to be greater than zero, and any point (x,y,z) will lie on the back of the plane if it satisfies the equation to be less than zero. 16

Plane Equations 17 Ax+By+Cz+D=0 where x,y,z is any point on a plane Three noncollinear points can determine A,B,C,D Select (x 1,y 1,z 1 ),(x 2,y 2,z 2 ),(x 3,y 3,z 3 )

Plane Equations 18 A=y 1 (z 2 -z 3 )+y 2 (z 3 -z 1 )+y 3 (z 1 -z 2 ) B=z 1 (x 2 -x 3 )+z 2 (x 3 -x 1 )+z 3 (x 1 -x 2 ) C=x 1 (y 2 -y 3 )+x 2 (y 3 -y 1 )+x 3 (y 1 -y 2 ) D= -x 1 (y 2 z 3 -y 3 z 2 )-x 2 (y 3 z 1 -y 1 z 3 )-x 3 (y 1 z 2 -y 2 z 1 ) As vertex values and other information are entered into the polygon data structure, values for A, B,C and D are computed for each polygon and then can be stored with other polygon data.

1.1.4 Polygon Meshes 19 Construct the object from triangles or quadrilaterals by tiling Most models are constructed this way Easy to work with Easy to render Rates about 300 million triangles/sec available with ordinary graphics cards for PC computers

Polygon Meshes -triangular meshes- 20 Free form/Boolean disadvantages: complexity of description & algorithms Representing a model as closed triangular mesh is EASY – Operations & Description format very simple Base representation for scanned data Most popular web representation

1.2 BEZIER CURVES AND SURFACES It is the better technique to generate complex natural scenes is to use fractals. Fractals are geometry methods which use procedures and not mathematical equations to model objects like mountains, waves in sea, etc. There are various kinds of fractals like self-similar, self- affined, etc. Bezier curves, which is a Spline approximation method developed by the French engineer Pierre Bezier for use in the design of Renault automobile bodies. 21

22 Spline is a flexible strip used to produce a smooth curve through a designated set of points known as Control points ( it is the style of fitting of the curve between these two points which gives rise to Interpolation and Approximation Splines). In computer graphics, the term spline curve now refers to any composite curve formed with polynomial sections satisfying specified continuity conditions (Parametric continuity and Geometric continuity conditions) at the boundary of the pieces, without fulfilling these conditions no two curves can be joined smoothly.

1.2.1 Bezier Curves 23 Bezier curves are used in computer graphics to produce curves which appear reasonably smooth at all scales. The Bezier curve require only two end points and other points that control the endpoint tangent vector. Bezier curve is defined by a sequence of N + 1 control points, P 0, P 1,..., P n. We defined the Bezier curve using the algorithm (invented by DeCasteljeau), based on recursive splitting of the intervals joining the consecutive control points.

24 De Casteljeau algorithm: The control points P0, P1, P2 and P3are joined with line segments called ‘control polygon’, even though they are not really a polygon but rather a polygonal curve. Each of them is then divided in the same ratio t : 1- t, giving rise to the another points. Again, each consecutive two are joined with line segments, which are subdivided and so on, until only one point is left. This is the location of our moving point at time t. The trajectory of that point for times between 0 and 1 is the Bezier curve.

25 A simple method for constructing a smooth curve that followed a control polygon p with m-1 vertices for small value of m, the Bezier techniques work well. However, as m grows large (m>20) Bezier curves exhibit some undesirable properties.

26

27

28 Bezier curves are commonly found in painting and drawing packages, as well as CAD system, since they are easy to implement and they are reasonably powerful in curve design.

29

1.2.2 Properties of Bezier Curves 30

31

Spline Development a) First-order splines find straight-line equations between each pair of points that Go through the points b) Second-order splines find quadratic equations between each pair of points that Go through the points Match first derivatives at the interior points c) Third-order splines find cubic equations between each pair of points that Go through the points Match first and second derivatives at the interior points Note that the results of cubic spline interpolation are different from the results of an interpolating cubic.

Cubic Splines While data of a particular size presents many options for the order of spline functions, cubic splines are preferred because they provide the simplest representation that exhibits the desired appearance of smoothness. Linear splines have discontinuous first derivatives Quadratic splines have discontinuous second derivatives and require setting the second derivative at some point to a pre- determined value. Quadratic or higher-order splines tend to exhibit the instabilities inherent in higher order polynomials (ill- conditioning or oscillations)

Cubic Splines (cont) In general, the i th spline function for a cubic spline can be written as: For n data points, there are n-1 intervals and thus 4(n-1) unknowns to evaluate to solve all the spline function coefficients.

Given a set of control points, cubic interpolation splines are obtained by fitting the input points with a piecewise cubic polynomial curve that passes through every control points. Suppose we have n+1 control points with coordinates : P k =(x k,y k,z k ) where k = 0 to n

We can describe the parametric cubic polynomial that is to be fitted between each pair of control points with the following set of equations : - x(u) = a x u 3 + b x u 2 + c x u + d x y(u) = a y u 3 + b y u 2 + c y u + d y z(u) = a z u 3 + b z u 2 + c z u + d z

Hermite Form Let’s look at an alternative way to describe a cubic curve Instead of defining it with the 4 control points as a Bezier curve, we will define it with a position and a tangent (velocity) at both the start and end of the curve (p 0, p 1, v 0, v 1 )

Hermite Curve v1v1 p1p1 p0p0 v0v0

Hermite Curves We want the value of the curve at t=0 to be x(0)=p 0, and at t=1, we want x(1)=p 1 We want the derivative of the curve at t=0 to be v 0, and v 1 at t=1

Hermite Curves

Matrix Form of Hermite Curve

Hermite Curves The Hermite curve is another geometric way of defining a cubic curve We see that ultimately, it is another way of generating cubic coefficients We can also see that we can convert a Bezier form to a Hermite form with the following relationship:

B-Spline The degree of a Bezier Curve is determined by the number of control points E. g. (bezier curve degree 11) – difficult to bend the "neck" toward the line segment P 4 P 5. Of course, we can add more control points. BUT this will increase the degree of the curve  increase computational burden

Joint many bezier curves of lower degree together (right figure) BUT maintaining continuity in the derivatives of the desired order at the connection point is not easy or may be tedious and undesirable. B-Spline

– moving a control point affects the shape of the entire curve- (global modification property) – undesirable. - Thus, the solution is B-Spline – the degree of the curve is independent of the number of control points - E.g - right figure – a B-spline curve of degree 3 defined by 8 control points

In fact, there are five Bézier curve segments of degree 3 joining together to form the B-spline curve defined by the control points little dots subdivide the B-spline curve into Bézier curve segments. Subdividing the curve directly is difficult to do  so, subdivide the domain of the curve by points called knots B-Spline 0 u 1

In summary, to design a B-spline curve, we need a set of control points, a set of knots and a degree of curve. B-Spline

Knots and Knot vectors of B-splines Knot Each subinterval endpoint u i Knot Vector Entire set of selected subinterval endpoints Choose any values for subinterval endpoints Only condition u i <= u i +1 u min and u max depend on The number of control points we select (n) Value for d (degree)

P(u) =  N i,k (u)p i (u 0 < u < u m ).. (1.0) Where basis function = N i,k (u) Degree of curve  k-1 Control points, p i  0 < i < n Knot, u  u 0 < u < u m m = n + k B-Spline curve i=0 n

B-Spline : definition P(u) =  N i,k (u)p i (u 0 < u < u m ) u i  knot [u i, u i+1 )  knot span (u 0, u 1, u 2, …. u m )  knot vector The point on the curve that corresponds to a knot u i,  knot point,P(u i ) If knots are equally space  uniform (e.g, 0, 0.2, 0.4, 0.6…) Otherwise  non uniform (e.g: 0, 0.1, 0.3, 0.4, 0.8 …)

Uniform knot vector Individual knot value is evenly spaced (0, 1, 2, 3, 4) Then, normalized to the range [0, 1] (0, 0.25, 0.5, 0.75, 1.0) B-Spline : definition

Type of B-Spline uniform knot vector Non-periodic knots (open knots) Periodic knots (non-open knots) -First and last knots are duplicated k times. -E.g (0,0,0,1,2,2,2) -Curve pass through the first and last control points -First and last knots are not duplicated – same contribution. -E.g (0, 1, 2, 3) -Curve doesn’t pass through end points. - used to generate closed curves (when first = last control points)

Type of B-Spline knot vector Non-periodic knots (open knots) Periodic knots (non-open knots) (Closed knots)

B-Spline basis function  In equation (1.1), the denominators can have a value of zero, 0/0 is presumed to be zero.  If the degree is zero basis function N i,1 (u) is 1 if u is in the i-th knot span [u i, u i+1 ). Otherwise (1.1) (1.2)

For example, if we have four knots u 0 = 0, u 1 = 1, u 2 = 2 and u 3 = 3, knot spans 0, 1 and 2 are [0,1), [1,2), [2,3) the basis functions of degree 0 are N 0,1 (u) = 1 on [0,1) and 0 elsewhere, N 1,1 (u) = 1 on [1,2) and 0 elsewhere, and N 2,1 (u) = 1 on [2,3) and 0 elsewhere. This is shown below B-Spline basis function

Properties of B-Spline 1. The m degree B-Spline function are piecewise polynomials of degree m  have C m-1 continuity.  e.g B-Spline degree 3 have C 2 continuity. u=1 u=2

Properties of B-Spline In general, the lower the degree, the closer a B-spline curve follows its control polyline. Degree = 7 Degree = 5Degree = 3

Properties of B-Spline Equality m = n + k must be satisfied Number of knots = m + 1 k cannot exceed the number of control points, n+ 1

Properties of B-Spline 2. Each curve segment is affected by k control points as shown by past examples.  e.g k = 3, P(u) = N i-1,k p i-1 + N i,k p i + N i+1,k p i+1

Properties of B-Spline Local Modification Scheme: changing the position of control point P i only affects the curve C(u) on interval [u i, u i+k ). Modify control point P 2

Properties of B-Spline 3. Strong Convex Hull Property: A B-spline curve is contained in the convex hull of its control polyline. More specifically, if u is in knot span [u i,u i+1 ), then C(u) is in the convex hull of control points P i-p, P i-p+1,..., P i. Degree = 3, k = 4 Convex hull based on 4 control points

Properties of B-Spline 4. Non-periodic B-spline curve C(u) passes through the two end control points P 0 and P n. 5. Each B-spline function Nk,m(t) is nonnegative for every t, and the family of such functions sums to unity, that is  N i,k (u) = 1 6. Affine Invariance to transform a B-Spline curve, we simply transform each control points. 7. Bézier Curves Are Special Cases of B-spline Curves i=0 n

Properties of B-Spline 8. Variation Diminishing : A B-Spline curve does not pass through any line more times than does its control polyline