3D concepts and object representation

65
UNIT - 4 3D concepts and object representation 1

description

3D concepts and object representation . UNIT - 4. Introduction :. Up to here we have seen that how lines, circle, ellipse, characters etc can be drawn. - PowerPoint PPT Presentation

Transcript of 3D concepts and object representation

Page 1: 3D concepts and object representation

UNIT - 4

3D concepts and object representation

1

Page 2: 3D concepts and object representation

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

Page 3: 3D concepts and object representation

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

Page 4: 3D concepts and object representation

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

Page 5: 3D concepts and object representation

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 15

Page 6: 3D concepts and object representation

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

Page 7: 3D concepts and object representation

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

Page 8: 3D concepts and object representation

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

Page 9: 3D concepts and object representation

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

Page 10: 3D concepts and object representation

1.1.2 Polygon TablesEvery 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

Page 11: 3D concepts and object representation

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

Page 12: 3D concepts and object representation

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

Page 13: 3D concepts and object representation

13

Page 14: 3D concepts and object representation

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

Page 15: 3D concepts and object representation

Polygon Tables

15

Vertex TableEdge TableSurface Table

E1

E2E4

E3

E5

E6

V1

V5V3V2

V4

VERTEX TABLE

V1 x1,y1,z1

V2 x2,y2,z2

V3 x3,y3,z3

V4 x4,y4,z4

V5 x5,y5,z5

POLYGON-SURFACE TABLE

S1 E1,E2,E3

S2 E3,E4,E5,E6

EDGE TABLE

E1 V1,V2

E2 V2,V3

E3 V3,V1

E4 V3,V4

E5 V4,V5

E6 V5,V1

Page 16: 3D concepts and object representation

1.1.3 Plane EquationPlane 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

Page 17: 3D concepts and object representation

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 (x1,y1,z1),(x2,y2,z2),(x3,y3,z3)

33

22

11

111

zyzyzy

A

33

22

11

111

zxzxzx

B

333

222

111

zyxzyxzyx

D

111

33

22

11

yxyxyx

C

Page 18: 3D concepts and object representation

Plane Equations

18

A=y1(z2-z3)+y2(z3-z1)+y3(z1-z2)B=z1(x2-x3)+z2(x3-x1)+z3(x1-x2)C=x1(y2-y3)+x2(y3-y1)+x3(y1-y2)D= -x1(y2z3-y3z2)-x2(y3z1-y1z3)-x3(y1z2-y2z1)

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.

Page 19: 3D concepts and object representation

1.1.4 Polygon Meshes

19

Construct the object from triangles or quadrilaterals by tiling

Most models are constructed this wayEasy to work withEasy to renderRates about 300 million triangles/sec

available with ordinary graphics cards for PC computers

Page 20: 3D concepts and object representation

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 dataMost popular web representation

Page 21: 3D concepts and object 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

Page 22: 3D concepts and object representation

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.

Page 23: 3D concepts and object representation

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, P0, P1,. . . , Pn.

We defined the Bezier curve using the algorithm (invented by DeCasteljeau), based on recursive splitting of the intervals joining the consecutive control points.

Page 24: 3D concepts and object representation

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.

Page 25: 3D concepts and object representation

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.

Page 26: 3D concepts and object representation

26

Page 27: 3D concepts and object representation

27

Page 28: 3D concepts and object representation

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.

Page 29: 3D concepts and object representation

29

Page 30: 3D concepts and object representation

1.2.2 Properties of Bezier Curves

30

Page 31: 3D concepts and object representation

31

Page 32: 3D concepts and object representation

Spline Developmenta) First-order splines find straight-line

equations between each pair of points that

• Go through the pointsb) Second-order splines find quadratic

equations between each pair of points that

• Go through the points• Match first derivatives at the interior

pointsc) Third-order splines find cubic

equations between each pair of points that

• Go through the points• Match first and second derivatives at

the interior pointsNote that the results of cubic spline interpolation are different from the results of an interpolating cubic.

Page 33: 3D concepts and object representation

Cubic SplinesWhile 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

derivativesQuadratic 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)

Page 34: 3D concepts and object representation

Cubic Splines (cont)In general, the ith 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.

six ai bi x xi ci x xi 2 di x xi 3

Page 35: 3D concepts and object representation

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 :

Pk=(xk,yk,zk) where k = 0 to n

Page 36: 3D concepts and object representation

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) = axu3 + bxu2 + cxu + dxy(u) = ayu3 + byu2 + cyu + dyz(u) = azu3 + bzu2 + czu + dz

Page 37: 3D concepts and object representation

Hermite FormLet’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 (p0, p1, v0, v1)

Page 38: 3D concepts and object representation

Hermite Curve

•v1p

1

p0

v0

Page 39: 3D concepts and object representation

Hermite CurvesWe want the value of the curve at t=0 to be

x(0)=p0, and at t=1, we want x(1)=p1We want the derivative of the curve at t=0 to

be v0, and v1 at t=1 cbacbavx

ccbavx

dcbadcbapx

ddcbapx

23 1213 1

0203 0

111 1

000 0

21

20

231

230

Page 40: 3D concepts and object representation

Hermite Curves

cbavcv

dcbapdp

231

0

1

0

Page 41: 3D concepts and object representation

Hermite Curves

dcba

vvpp

cbavcv

dcbapdp

0123010011111000

23

1

0

1

0

1

0

1

0

Page 42: 3D concepts and object representation

Matrix Form of Hermite Curve

1

0

1

0

1

0

1

01

000101001233

1122

0123010011111000

vvpp

dcba

vvpp

dcba

Page 43: 3D concepts and object representation

Matrix Form of Hermite Curve

CtxGBtx

x

HrmHrm

zyx

zyx

zyx

zyx

vvvvvvpppppp

ttt

111

000

111

000

23

000101001233

1122

1

Page 44: 3D concepts and object representation

Hermite CurvesThe Hermite curve is another geometric

way of defining a cubic curveWe see that ultimately, it is another way of

generating cubic coefficientsWe can also see that we can convert a

Bezier form to a Hermite form with the following relationship:

HrmHrmBezBez GBGBC

Page 45: 3D concepts and object representation

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 P4P5.

Of course, we can add more control points.

BUT this will increase the degree of the curve increase computational burden

Page 46: 3D concepts and object representation

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

Page 47: 3D concepts and object representation

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

Page 48: 3D concepts and object representation

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

Page 49: 3D concepts and object representation

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

Page 50: 3D concepts and object representation

Knots and Knot vectors of B-splines

KnotEach subinterval endpoint ui

Knot VectorEntire set of selected subinterval endpoints

Choose any values for subinterval endpoints Only condition ui <= u i +1u min and u max depend on

The number of control points we select (n)Value for d (degree)

Page 51: 3D concepts and object representation

P(u) = Ni,k(u)pi (u0 < u < um).. (1.0)

Where basis function = Ni,k(u)Degree of curve k-1Control points, pi 0 < i < nKnot, u u0 < u < um

m = n + k

B-Spline curve

i=0

n

Page 52: 3D concepts and object representation

B-Spline : definition P(u) = Ni,k(u)pi (u0 < u < um)ui knot[ui, ui+1) knot span(u0, u1, u2, …. um ) knot vectorThe point on the curve that corresponds to a

knot ui, knot point ,P(ui)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 …)

Page 53: 3D concepts and object representation

Uniform knot vectorIndividual 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

Page 54: 3D concepts and object representation

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)

Page 55: 3D concepts and object representation

Type of B-Spline knot vector

Non-periodic knots (open knots)

Periodic knots (non-open knots)

(Closed knots)

Page 56: 3D concepts and object representation

B-Spline basis function

2 1

1,1

1

1,,

iki

kiki

iki

kiiki uu

uNuu

uuuN

uuuN

3 selainnya. 0

1 1

1,

iii

uuuN

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 Ni,1(u) is 1 if u is in the i-th knot span [ui, ui+1).

Otherwise

(1.1)

(1.2)

Page 57: 3D concepts and object representation

For example, if we have four knots u0 = 0, u1 = 1, u2 = 2 and u3 = 3, knot spans 0, 1 and 2 are [0,1), [1,2), [2,3)

the basis functions of degree 0 are N0,1(u) = 1 on [0,1) and 0 elsewhere, N1,1(u) = 1 on [1,2) and 0 elsewhere, and N2,1(u) = 1 on [2,3) and 0 elsewhere.

This is shown below

B-Spline basis function

Page 58: 3D concepts and object representation

Properties of B-Spline1. The m degree B-Spline function are

piecewise polynomials of degree m have Cm-1 continuity. e.g B-Spline degree 3 have C2 continuity.

u=1

u=2

Page 59: 3D concepts and object representation

Properties of B-SplineIn general, the lower the degree, the closer a B-spline curve follows its control polyline.

Degree = 7 Degree = 5 Degree = 3

Page 60: 3D concepts and object representation

Properties of B-SplineEquality m = n + k must be satisfiedNumber of knots = m + 1k cannot exceed the number of control

points, n+ 1

Page 61: 3D concepts and object representation

Properties of B-Spline2. Each curve segment is affected by k

control points as shown by past examples. e.g k = 3, P(u) = Ni-1,k pi-1 + Ni,k pi+ Ni+1,k pi+1

Page 62: 3D concepts and object representation

Properties of B-SplineLocal Modification Scheme: changing the position of control point Pi only affects the curve C(u) on interval [ui, ui+k).

Modify control point P2

Page 63: 3D concepts and object representation

Properties of B-Spline3. 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 [ui,ui+1), then C(u) is in the convex hull of control points Pi-p, Pi-p+1, ..., Pi. Degree = 3, k = 4

Convex hull based on 4 control points

Page 64: 3D concepts and object representation

Properties of B-Spline4. Non-periodic B-spline curve C(u)

passes through the two end control points P0 and Pn.

5. Each B-spline function Nk,m(t) is nonnegative for every t, and the family of such functions sums to unity, that is Ni,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

Page 65: 3D concepts and object representation

Properties of B-Spline8. Variation Diminishing : A B-Spline

curve does not pass through any line more times than does its control polyline