程序代写 CM0304 Graphics I Graphics Hardware I.1 Graphics Systems

CM0304 Graphics I Graphics Hardware I.1 Graphics Systems

CMT107 Visual Computing

Copyright By PowCoder代写 加微信 powcoder

VII.2 Freeform Surfaces

Xianfang Sun

School of Computer Science & Informatics
Cardiff University

➢ Surface representations

➢ Parametric surfaces

➢ Piecewise polynomial surfaces

• Tensor product splines

➢ Subdivision surfaces

• Loop subdivision

• Doo-Sabin subdivision

• Catmull-Clark subdivision

15:21 2CMT107 Visual Computing

➢ We require general surface shapes

(something better than polygonal meshes)

• Exact boundary representation for some objects

• Create, edit and analyse shapes

15:21 3CMT107 Visual Computing

Explicit Surfaces

15:21 4CMT107 Visual Computing

➢ A surface is a set of positions of a point moving with two
degrees of freedom

➢ Explicit and implicit representation similar to curve
• Explicit: z = f(x, y) for (x, y)  R2

Implicit Surfaces

15:21 5CMT107 Visual Computing

➢ Surface defined as solution of an equation system:
f(x, y, z) = 0

• Usually one equation in 3D
➢ Example: linear equation (plane)

ax + by + cz + d = 0
• Using vectors:

nTx + d = 0
— n: unit plane normal
— d: distance from origin

➢ Quadrics (quadratic surfaces)

• Matrix representation:
xTMx + vTx + s = 0

•Sphere / Ellipsoid:

• Cylinder (elliptic):

• Cone (elliptic):

Implicit Quadrics

15:21 6CMT107 Visual Computing

=+++++++++ kjzhygxfxzeyzdxyczbyax

http://en.wikipedia.org/wiki/Quadric

Properties of Implicit Surfaces

15:21 7CMT107 Visual Computing

• Simple to test if point is on surface
• Simple to intersect two surfaces

Mathematical Functions / Sets

• Hard to render
• Hard to describe complex shapes

Blobby Models

Parametric Surfaces
➢Describe points on surface by parametric functions

• Maps 2D (u,v) parameter domain to 3D (x,y,z)
model space

➢ Example: ellipsoid
• x(u, v) = rx cos u cos v

y(u, v) = ry cos u sin v
z(u, v) = rz sin u
(u, v)  [-/2, /2]  [0, 2]

15:21 8CMT107 Visual Computing

Properties of Parametric Surfaces
➢ Properties similar to parametric curves

• Simple to render points

• Hard to test if point is on surface, compute intersections,

➢ Hard to represent whole surface by single polynomial

• Use piecewise polynomial surfaces

• Surface is cut into patches

• Smoothness / continuity problem when joining patches

15:21 9CMT107 Visual Computing

Piecewise Polynomial Surface
➢ Spline surface: piecewise polynomial surface patches

➢Use spline curve approach with two degrees of freedom

• Each patch is defined by a set of control points

15:21 10CMT107 Visual Computing

Tensor Product
➢ Intuitively, a surface is a curve which moves

through space while it changes its shape

• Mathematically this is the tensor product of two curves

15:21 11CMT107 Visual Computing

Tensor Product Surfaces
➢ Surface patch as a curve moving through space

• Assume this curve is at any time v  [0, 1] a Bézier

• The control points Pl(v) lie on curves as well, assume

these are also Bézier curves

➢ Combing both gives the formula for a Bézier surface patch

15:21 12CMT107 Visual Computing

Bézier Surface Patches
➢ Point Q(u, v) on the patch is the tensor product of

Bézier curves defined by the control points Pl,k

• Order of surface is given by order of curves , 

(e.g. bicubic:  =  = 3)
15:21 13CMT107 Visual Computing

Properties of Bézier Patches
➢ Interpolates four corner control points

➢ Lies inside convex hull of control points

➢ Changing control points has only local effect (local

15:21 14CMT107 Visual Computing

Smooth Bézier Surfaces
➢ Continuity / smoothness constraints similar to

Bézier splines

15:21 15CMT107 Visual Computing

C0 and C1 Bézier Surfaces
➢ C0 requires aligning boundary curves

➢ C1 requires aligning boundary curves and derivatives

15:21 16CMT107 Visual Computing

Drawing Bézier Surfaces
➢ Simple approach:

loop through uniformly spaced increments of u and v

for (int l = 0; l < lmax; ++l) { double u = umin + l * ustep; for (int k = 0; k < kmax; ++k) { double v = vmin + k * vstep; DrawQuadrilateral (...); • Note, Bézier surfaces always have quadrilateral structure 15:21 17CMT107 Visual Computing Drawing Bézier Surfaces ➢ Better approach: use adaptive subdivision DrawSurface (surface) { if flat(surface, epsilon) { DrawQuadrilateral (surface); SubdivideSurface (surface,...); DrawSurface (surfaceLL); DrawSurface (surfaceLR); DrawSurface (surfaceRL); DrawSurface (surfaceRR); 15:21 18CMT107 Visual Computing Drawing Bézier Surfaces ➢ Problem of adaptive subdivision: • Cracks at boundaries between patches at different subdivision levels • Avoid cracks by adding extra vertices and triangulating quadrilaterals with neighbours at finer level 15:21 19CMT107 Visual Computing Subdivision Surfaces ➢Idea of subdivision surfaces • Define a smooth surface as the limit of a sequence of successive refinements of a mesh 15:21 20CMT107 Visual Computing Why Subdivision? ➢ Level of Detail ➢ Compression ➢ Smoothing 15:21 21CMT107 Visual Computing Cutting Corners – Curves 15:21 22CMT107 Visual Computing Surface Subdivision ➢ Start with a control mesh ➢ Per iteration construct refined mesh by inserting vertices ➢ Mesh sequence should converge to a limit surface ➢ Subdivision scheme defined by two elements • Generate topology of the new mesh • Compute vertex locations in new mesh — Vertex point: new location of old vertex — Edge point: location of new vertex on old edge — Face point: location of new vertex on old face 15:21 23CMT107 Visual Computing Loop Subdivision ➢Loop subdivision scheme: • Refine each triangle into 4 triangles by splitting each edge and connecting new vertices 15:21 24CMT107 Visual Computing Loop Subdivision ➢ Computing locations of new vertices • Weighted average of original vertices in neighbourhood Edge point Vertex point • No face points 15:21 25CMT107 Visual Computing  = − +        ➢Mesh is the control mesh of a B-Spline surface • Refined mesh is also a control mesh of a B-Spline ➢Incremental construction • Calculate face points • Calculate edge points using face points • Calculate vertex points using face and edge points • Connect vertices 15:21 26CMT107 Visual Computing 15:21 27CMT107 Visual Computing ➢Connecting new vertices: • Connect each new face point to edge points of the edges defining the old face • Connect each new vertex point to new edge points of all old edges incident on the old vertex point 15:21 28CMT107 Visual Computing 15:21 29CMT107 Visual Computing Face Point Vertex Point Edge Point ( 3)2 p nQ R ❑ Q – Average of face points ❑ R – Average of midpoints ❑ p – old vertex 15:21 30CMT107 Visual Computing ( ),0 3 2cos 2 / Properties of Subdivision Surfaces ➢ Advantages • Simple methods for describing complex surfaces • Multi-resolution evaluation and manipulation • Arbitrary topology of control mesh (not only quadrilateral) • Limit surface is smooth ➢ Disadvantages • No obvious parametrisation • Hard to find intersections 15:21 31CMT107 Visual Computing 15:21 32CMT107 Visual Computing ➢What are parametric surfaces? What are their advantages and disadvantages? ➢What are spline surfaces? What are their advantages and disadvantages? What is the major problem when defining surfaces “piecewise”? ➢What is the principle of a tensor product surface? What are Bézier surfaces? What conditions do the control points of C0/C1 continuous Bézier surfaces have to fulfil? ➢What is the principle of subdivision surfaces? What are their advantages / disadvantages? ➢ How do Loop, Catmull-Clark, Doo-Sabin subdivision schemes work? 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com