modeling & curves - boise state...

61
Modeling & Curves

Upload: others

Post on 11-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Modeling & Curves

Page 2: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Modeling

What is Modeling?

Creating a model of an object, usually out of a collection of

simpler primitives

Primitive

A basic shape handled directly the rendering system

Page 3: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

OpenGL Primitives

Page 4: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

GLUT Primitives void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);

void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);

void glutSolidCube(GLdouble size);

void glutWireCube(GLdouble size);

void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint

stacks);

void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint

stacks);

void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint

nsides, GLint rings);

void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint

nsides, GLint rings);

12-sided regular solid

void glutSolidDodecahedron(void);

void glutWireDodecahedron(void);

4-sided regular solid

void glutSolidTetrahedron(void);

void glutWiredTetrahedron(void);

20-sided regular solid

void glutSolidIcosahedron(void);

void glutWireIcosahedron(void);

8-sided regular solid

void glutSolidOctahedron(void);

void glutWireOctahedron(void);

void glutSolidTeapot(GLdouble size);

void glutWireTeapot(GLdouble size);

Page 5: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Some Common Primitives

Triangles & Polygons

Most common, usually the only choice for interactive

Patches, Spheres, Cylinders, ...

RenderMan & GLUT has these

Often converted to simpler primitives within the renderer

Volumes

What’s at each point in space?

Often with some transparent material

Few renderers handle both volume & surface models

Page 6: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Why do you need a mesh/surface?

More interesting applications

Page 7: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

So you need a mesh…

• Buy it (or find a free one)

– Free meshes typically are not very good quality

• User defined: A user builds the mesh

– Tools help with specifying many vertices and faces quickly

– Take any user-friendly modeling technique, and extract a

mesh representation from it

• Scan a real object

– 3D probe-based systems

– Range finders

• Image based reconstruction

– Take a bunch of pictures, and infer the object’s shape

Page 8: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

So you need a mesh…

• Buy it (or find a free one)

– Free meshes typically are not very good quality

• User defined: A user builds the mesh

– Tools help with specifying many vertices and faces quickly

– Take any user-friendly modeling technique, and extract a

mesh representation from it

• Scan a real object

– 3D probe-based systems

– Range finders

• Image based reconstruction

– Take a bunch of pictures, and infer the object’s shape

Page 9: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Tools

Maya

Blender

Google Sketchup?

Any other tools?

Computer-generated image created by Gilles Tran.

List of 3D Modeling software: http://en.wikipedia.org/wiki/List_of_3D_modeling_software

Page 10: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Limitations of Polygonal Meshes

• They are inherently an approximation

– Things like silhouettes can never be perfect without very

large numbers of polygons, and corresponding expense

– Normal vectors are not specified everywhere

• Interaction is a problem

– Dragging points around is time consuming

– Maintaining things like smoothness is difficult

Page 11: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Limitations of Polygonal Meshes

Low level representation

Eg: Hard to increase, or decrease, the resolution

Hard to extract information like curvature

Page 12: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Extrusion

Spline Surfaces/Patches

Surface of Revolution

Quadrics and other

implicit polynomialsSlide credits: Durand & Cutler

Some Non-Polygonal Modeling Tools

Page 13: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

0 t1

Mapping:F:t→(x,y)

0

1(Fx(t), Fy(t))

What are Parametric Curves?

• Define a parameter space

– 1D for curves

– 2D for surfaces

• Define a mapping from parameter space to 3D points

– A function that takes parameter values and gives back 3D

points

• The result is a parametric curve or surface

Page 14: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Why Parametric Curves?

• Parametric curves are intended to provide the generality

of polygon meshes but with fewer parameters for

smooth surfaces

– Polygon meshes have as many parameters as there are

vertices (at least)

• Fewer parameters makes it faster to create a curve, and

easier to edit an existing curve

• Normal vectors and texture coordinates can be easily

defined everywhere

• Parametric curves are easier to animate than polygon

meshes

Page 15: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• We know the parametric form for a line:

• Note that x, y and z are each given by an equation

that involves:

– The parameter t

– Some user specified control points, x0 and x1

• This is an example of a parametric curve

10

10

10

)1()1()1(

tzztztyytytxxtx

Parametric Curves

Page 16: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• A line is the sum of two functions multiplied

by vectors:

• A linear combination of basis functions– t and 1-t are the basis functions

• The weights are called control points/knots– (x0 ,y0 ,z0) and (x1 ,y1 ,z1) are the control points

– They control the shape and position of the curve

1

1

1

0

0

0

1

z

y

x

t

z

y

x

t

z

y

x

Basis Functions (first sighting)

Page 17: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Hermite Spline

• A spline is a parametric curve defined by control points

– The term spline dates from engineering drawing, where a spline was a piece of flexible wood used to draw smooth curves

– The control points are adjusted by the user to control the shape of the curve

– http://pages.cs.wisc.edu/~deboor/draftspline.html

Page 18: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Hermite Spline

A Hermite spline is a curve for which the user provides: The endpoints of the curve

The parametric derivatives of the curve at the endpoints (tangents with length) The parametric derivatives are dx/dt, dy/dt, dz/dt

That is enough to define a cubic Hermite spline

Show Demo

Charles Hermite

Image credits: Wolfram Research

http://www.siggraph.org/education/materials/HyperGra

ph/modeling/splines/demoprog/curve.html

Page 19: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

0x

0dt

dx

1dt

dx

1x

Start Point

End Point

Start Tangent End Tangent

Control Point Interpretation

Page 20: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• Say the user provides

• A cubic spline has degree 3, and is of the form:

• We have constraints:

– The curve must pass through x0 when t=0

– The derivative must be x’0 when t=0

– The curve must pass through x1 when t=1

– The derivative must be x’1 when t=1

dctbtatx 23

1

1

0

010 ,,,

dt

d

dt

d xxxx

Hermite Spline (2)

Page 21: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• Solving for the unknowns gives:

• Rearranging gives:

0

0

0101

0101

233

22

xd

xc

xxxxb

xxxxa

)2(

)(

)132(

)32(

23

0

23

1

23

0

23

1

ttt

tt

tt

tt

x

x

x

xx

10121

0011

1032

00322

3

0101t

t

t

xxxxxor

Hermite Spline (3)

Page 22: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

1.2

x1

x0

x'1

x'0

Basis Functions

A point on a Hermite curve is obtained by multiplying

each control point by some function and summing

Page 23: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• For higher dimensions, define the control points in

higher dimensions (that is, as vectors)

Splines in 2D and 3D

10121

0011

1032

00322

3

0101

0101

0101

t

t

t

zzzz

yyyy

xxxx

z

y

x

Page 24: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Break

Questions?

GLM – OpenGL Mathematics (GLM) Library

Transformations, Lighting library

http://glm.g-truc.net/

http://glm.g-truc.net/code.html

Page 25: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Curves

• Different choices of basis functions give different

curves

– Choice of basis determines how the control points influence

the curve

– In Hermite case, two control points define endpoints, and

two more define parametric derivatives

• For Bezier curves, two control points define

endpoints, and two control the tangents at the

endpoints in a geometric way

Page 26: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

0x

3x

Start Point

End Point

Point along start tangent

Point along end Tangent

2x

1x

Control Point Interpretation

Page 27: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Curves of Varying Degree

Page 28: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• The user supplies d control points, pi

• Write the curve as:

• The functions Bid are the Bernstein polynomials of

degree d

• This equation can be written as a matrix equation also

– One can even write a matrix to take Hermite control

points to Bezier control points

d

i

d

ii tBt0

px idid

i tti

dtB

1

Bezier Curves

Page 29: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bernstein Polynomials

The Bernstein polynomials of

degree n form a basis for the

power polynomials of degree n.

The first few polynomials are

Page 30: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

0

0.2

0.4

0.6

0.8

1

1.2

B0

B1

B2

B3

Bezier Basis Functions for d=3

Page 31: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Curve Properties

• The first and last control points are interpolated

• The tangent to the curve at the first control point is along the line joining the first and second control points

• The tangent at the last control point is along the line joining the second last and last control points

• The curve lies entirely within the convex hull of its control points

– The Bernstein polynomials (the basis functions) sum to 1 and are positive everywhere

• They can be rendered in many ways

– E.g.: Convert to line segments with a subdivision algorithm

Credits: http://ezekiel.vancouver.wsu.edu/~cs442/lectures/bezier/bezier.pdf

Page 32: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Rendering Bezier Curves

• 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

Page 33: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Curve Demo

http://en.wikipedia.org/wiki/Bezier_Curve#Constructing_

B.C3.A9zier_curves

http://www.jasondavies.com/animated-bezier/

Page 34: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Longer Curves

• A single cubic Bezier or Hermite curve can only capture a small class of curves

– At most 2 inflection points

• One solution is to raise the degree

– Allows more control, at the expense of more control points and higher degree polynomials

– Control is not local, one control point influences entire curve

Page 35: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Longer Curves

• Alternate, most common solution is to join pieces of cubic curve together into piecewise cubic curves

– Total curve can be broken into pieces, each of which is cubic

– Local control: Each control point only influences a limited part of the curve

– Interaction and design is much easier

Page 36: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

“knot”P0,0

P0,1 P0,2

P0,3

P1,0

P1,1

P1,2

P1,3

Piecewise Bezier Curve

Page 37: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Continuity

• When two curves are joined, we typically want some degree of continuity across the boundary (the knot)

– C0, “C-zero”, point-wise continuous, curves share the same point where they join

– C1, “C-one”, continuous derivatives, curves share the same parametric derivatives where they join

– C2, “C-two”, continuous second derivatives, curves share the same parametric second derivatives where they join

– Higher orders possible

– C1 continuity demo -http://www.cs.princeton.edu/~min/cs426/jar/bezier.html

Page 38: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Continuity

P0,0

P0,1 P0,2

J

P1,1

P1,2

P1,3

Disclaimer: PowerPoint curves are not Bezier curves, they are

interpolating piecewise quadratic curves! This diagram is an

approximation.

Page 39: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Geometric Continuity

• Derivative continuity is important for animation

– If an object moves along the curve with constant parametric speed, there should be no sudden jump at the knots

• For other applications, tangent continuity might be enough

– Requires that the tangents point in the same direction

– Referred to as G1 geometric continuity

– Curves could be made C1 with a re-parameterization: u=f(t)

– The geometric version of C2 is G2, based on curves having the same radius of curvature across the knot

• What is the tangent continuity constraint for a Bezier curve?

Page 40: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

P0,0

P0,1 P0,2

J

P1,1 P1,2

P1,3

)()( 2,01,1 PJJP k for some k

Bezier Geometric Continuity

Page 41: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

s

t

s

x(s,t)

P0,0

P1,0

P1,1P0,1

x(s,0)

x(s,1)

1

0

1

0

,,,

,1,0

,1,0

1,11,0

0,10,0

)()(),(

,1

,1

)1,()0,()1(),(

)1()1,(

)1()0,(

i j

tjsiji

tt

ss

tFsFPtsx

tFtF

sFsF

stxsxttsx

sPPssx

sPPssx

Parametric Surfaces

• Define points on the surface in terms of two parameters

• Simplest case: bilinear interpolation

Page 42: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• Defined over a rectangular domain

– Valid parameter values come from within a rectangular

region in parameter space: 0s<1, 0t<1

• Use a rectangular grid of control points to specify the

surface

– 4 points in the bi-linear case on the previous slide, more in

other cases

• Surface takes the form:

– For some functions Fi,s and Fj,t

s td

i

d

j

tjsiji tFsFts0 0

,,, )()(),( Px

Tensor Product Surface Patches

Page 43: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Patches

• As with Bezier curves, Bin(s) and Bj

m(t) are the Bernstein polynomials of degree n and m respectively

• Most frequently, use n=m=3: cubic Bezier patch

– Need 4x4=16 control points, Pi,j

n

i

m

j

m

j

n

iji tBsBts0 0

,, Px

Image credits: James O’Brien

Page 44: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

x(s,t)

Bezier Patches

• Edge curves are Bezier curves

• Any curve of constant s or t is a Bezier curve

• One way to think about it:

– Each row of 4 control points defines a Bezier curve in s

– Evaluating each of these curves at the same s provides 4 virtual control points

– The virtual control points define a Bezier curve in t

– Evaluating this curve at t gives the point x(s,t)

Page 45: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Properties of Bezier Patches

Which vertices, if any, does the patch interpolate? Why?

What can you say about the tangent plane at each

corner? Why?

Does the patch lie within the convex hull of its control

vertices?

Think-pair-share (2-2-2) activity

Page 46: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Properties of Bezier Patches

The patch interpolates its corner points

Comes from the interpolation property of the underlying curves

The tangent plane at each corner interpolates the corner

vertex and the two neighboring edge vertices

The tangent plane is the plane that is perpendicular to the normal vector

at a point

The tangent plane property derives from the curve tangent properties

and the way to compute normal vectors

The patch lies within the convex hull of its control vertices

The basis functions sum to one and are positive everywhere

Page 47: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

1

t

t

t

0001

0033

0363

1331

PPPP

PPPP

PPPP

PPPP

0001

0033

0363

1331

1ssstsx

PBTBStsx

2

3

33231303

32221202

31211101

30201000

23

TT

,,,,

,,,,

,,,,

,,,,

),(

),(

1

1),(2

3

3,32,31,30,3

3,22,21,20,2

3,12,11,10,1

3,02,01,00,0

23

t

t

t

MMMM

MMMM

MMMM

MMMM

ssstsx

Bezier Patch Matrix Form

• Note that the 3 matrices stay the same if the control points do not change

– The middle product can be pre-computed, leaving only:

Page 48: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

OK

OK Not OK Not OK

Bezier Patch Meshes

• A patch mesh is just many patches joined together along their edges

– Patches meet along complete edges

– Each patch must be a quadrilateral

Page 49: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Mesh Continuity

• Just like curves, the control points must satisfy

constraints to ensure parametric continuity

• How do we ensure C0 continuity along an edge?

Share control points at the edge

How do we ensure C1 continuity along an edge?

Control points across edge are collinear and equally spaced

How do we ensure C2 continuity along an edge?

Constraints extent to points farther from the edge

Page 50: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Mesh Continuity

• For geometric continuity, constraints are less rigid

• What can you say about the vertices around a corner if

there must be C1 continuity at the corner point?

• They are co-planar (not the interior points, just corner and edge)

Page 51: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Rendering Bezier Patches

• Evaluate at fixed set of parameter values and

join up with triangles– Can’t use quadrilaterals because points may not be co-planar

– Ideal situation for triangle strips

– Advantage: Simple, and OpenGL has commands to do it for

you

– Disadvantage: No easy way to control quality of appearance

Page 52: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• The partial derivative in the s direction is one tangent

vector

• The partial derivative in the t direction is another

• Take their cross product, and normalize, to get the

surface normal vector

n

i

m

j

m

j

s

n

iji

ts

tBds

dB

s 0 0

,

,

Px

n

i

m

jt

m

jn

iji

ts dt

dBsB

t 0 0

,

,

Px

n

nn

xxn

ˆ

,, tsts ts

Computing Normal Vectors

Page 53: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Normal Vectors

Face Normals

Vertex Normals

Page 54: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Bezier Curve/Surface Problems

• To make a long continuous curve with Bezier segments

requires using many segments

– Same for large surface

• Maintaining continuity requires constraints on the

control point positions

– The user cannot arbitrarily move control vertices and

automatically maintain continuity

– The constraints must be explicitly maintained

– It is not intuitive to have control points that are not

free

Page 55: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Screenshots of Assignment 2

Page 56: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

B-splines

• B-splines automatically take care of continuity, with

exactly one control vertex per curve segment

• Many types of B-splines: degree may be different (linear,

quadratic, cubic,…) and they may be uniform or non-

uniform

• With uniform B-splines, continuity is always one degree

lower than the degree of each curve piece

– Linear B-splines have C0 continuity, cubic have C2, etc

Page 57: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Cubic B-spline

1331

0363

0303

0141

MS

p(u) = uTMSp = b(u)Tp

u

uuu

uu

u

u

3

22

32

3

3331

364

)1(

6

1)(b

Page 58: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

B-splines Demo

http://www.siggraph.org/education/materials/HyperGraph/

modeling/splines/demoprog/curve.html

http://www.agt.bme.hu/szakm/szg/Spline.html

Page 59: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

B-spline Patches

vupvbubvup TSS

T

ijj

i j

i MPM

)()(),(3

0

3

0

defined over only 1/9 of region

Page 60: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

• Utah Teapot - http://www.sjbaker.org/teapot/

• The teapot was made by Melitta in 1974 and originally

belonged to Martin Newell and his wife, Sandra - who

purchased it from ZCMI, (a department store in Salt Lake

City).

Trivia

Page 61: Modeling & Curves - Boise State Universitycs.boisestate.edu/~alark/cs464/lectures/Modeling_Curves_Surfaces.pdf• Parametric curves are easier to animate than polygon meshes ... x

Slide courtesy: Fredo Durand

Modeling with Bicubic Bezier Patches

Original Teapot specified with Bezier Patches