Advanced Computer Graphics Advanced Computer Graphics CS 563: Curves - - PowerPoint PPT Presentation

advanced computer graphics advanced computer graphics cs
SMART_READER_LITE
LIVE PREVIEW

Advanced Computer Graphics Advanced Computer Graphics CS 563: Curves - - PowerPoint PPT Presentation

Advanced Computer Graphics Advanced Computer Graphics CS 563: Curves and Curved Surfaces William DiSanto Computer Science Dept. Worcester Polytechnic Institute (WPI) O Overview i Advantages/Disadvantages / Implicit Surfaces


slide-1
SLIDE 1

Advanced Computer Graphics Advanced Computer Graphics CS 563: Curves and Curved Surfaces William DiSanto

Computer Science Dept. Worcester Polytechnic Institute (WPI)

slide-2
SLIDE 2

O i Overview

/

 Advantages/Disadvantages  Implicit Surfaces  Parametric Paths  Parametric Surfaces  NURBS  Demos  Demos

slide-3
SLIDE 3

Wh U C ? Why Use Curves?

 Compact Representation

 Control Points, Knots, Weights

 Usually Scale/Rotation/Translation Invariant

y

 Smooth well Defined Derivatives

 Good for paths

p

 Curves can represent triangle mesh exactly  Support surfaces of arbitrary dimension  Support surfaces of arbitrary dimension

slide-4
SLIDE 4

Di d t t C d S f Disadvantages to Curved Surfaces

 Can be difficult to implement  Expensive to render  Hard to fit

Hard to fit

 Few SW packages support diverse features

needed needed

 Often reduced to tri‐mesh anyway  Subdivision surfaces may suffice  Subdivision surfaces may suffice  Extraordinarily unintuitive to manipulate

d f i di i i

 Hard for artists to edit in a precise manner  Some artists prefer since its reliably scalable (scan in)

slide-5
SLIDE 5

I li it S f Implicit Surfaces

Blending

slide-6
SLIDE 6

P t i C Parametric Curves

 Each coordinate is expressed as and explicit

function of some independent parameters

Parametric Linear Curve Parametric Linear Curve

slide-7
SLIDE 7

Bé i C Bézier Curves

 Curves from repeatedly linear interpolation on control points  Curve will have continuity = # of control points – 2  Can be expressed as a recurrence over control points

Quadratic Curve from Control Points (a,b,c), t = 1/3

slide-8
SLIDE 8

Bé i C Bézier Curves

 Curves tend to remain in the convex hull of the control points  Curves tend to remain in the convex hull of the control points  Notice the entire curve is effected by every single control point

Except for position at t = 0.0 and t = 1.0 p p

Cubic Bézier Curve

slide-9
SLIDE 9

d C t lj Al ith de Casteljau Algorithm

 Generate a tree of linear interpolation points  Generate a tree of linear interpolation points

  • riginating from the point on the curve at time t
slide-10
SLIDE 10

B t i P l i l Bernstein Polynomials

 Algebraic Form for Bézier Curve  Algebraic Form for Bézier Curve

Same as before

slide-11
SLIDE 11

B t i P l i l Bernstein Polynomials

 Polynomials can be pre‐computed and used later  Binomial coefficient may make solution unstable for

large numbers of control point

slide-12
SLIDE 12

R ti l Bé i C Rational Bézier Curves

 Use weighted ratio of Bernstein Polynomials  Rational Functions Allow for representation of conic curves

Example: Unit Circle

Can find weights by substitution Quadrant of unit circle represented with Bézier Curve

slide-13
SLIDE 13

H C di t Homogenous Coordinates

 View Rational Polynomial as n‐dimensional non‐rational

polynomial projected into n+1 dimensional space polynomial projected into n+1 dimensional space

Perspective projection looking down the n+1th dimensional axis

Project onto W = 1

 Computationally efficient representation

slide-14
SLIDE 14

Bé i C GPU (fill d) Bézier Curves on GPU (filled)

 Map control points to canonical texture space  Texture coordinates are interpolated on hardware  Test per‐pixel texture coordinates against

algebraic expression of the curve to shade

slide-15
SLIDE 15

Pi i Bé i C Piecewise Bézier Curves

 Curves can be joined together

 Edge control points must match  Internal points must be positioned to preserve continuity C0 G1 (Tangent DirectionMatch) C1

slide-16
SLIDE 16

C bi H it I t l ti Cubic Hermite Interpolation

 Spline controlled by 2 control points and 2 tangents  In general values and some derivatives at sample points

must be known

slide-17
SLIDE 17

K h k B t l C Kochanek‐Bartels Curves

 Stitch together Cubic Hermite splines

 Tension parameter (controls pinching at point)  Bias parameter (biases hump before/after ith point)  No tension and no bias produces Catmull‐Rom spline

slide-18
SLIDE 18

K h k B t l C Kochanek‐Bartels Curves

 Can define both input and output tangents per point  Another parameter (continuity)

 Determines how much in/out tangents agree  Can be used to make sharp corners

a = tension b = bias c = continuity a tension b bias c continuity

slide-19
SLIDE 19

Bé i P t h Bézier Patches

 Bi‐linearly Interpolate between control points  Bi linearly Interpolate between control points

slide-20
SLIDE 20

Bé i P t h Bézier Patches

Generate Interpolation Points within Quads

slide-21
SLIDE 21

B t i P t h Bernstein Patches

Different Degrees in each Dimension Possible

slide-22
SLIDE 22

D i ti Derivatives

D i ti d l ll d fi d

 Derivatives and normals well defined

slide-23
SLIDE 23

Bé i P t h Bézier Patches

B l C t l i t t d i t d

 Below: Control points, connected points and

normals sampled from the patches, and a render

  • f the computed quads
  • f the computed quads
slide-24
SLIDE 24

Bé i P t h Bézier Patches

Manipulation of Control Points

slide-25
SLIDE 25

R ti l Bé i P t h Rational Bézier Patches

 Surface still contained within convex hull

slide-26
SLIDE 26

Bé i T i l Bézier Triangles

 Interpolate with barycentric coordinates

slide-27
SLIDE 27

B t i T i l Bernstein Triangles

slide-28
SLIDE 28

Bé i T i l R t ti Bézier Triangle: Representations

 de Casteljau  de Casteljau  Bernstein  Bernstein  Derivatives

slide-29
SLIDE 29

N P t h N‐Patches

 Generate smooth LOD mesh with N‐Patches

 Each triangle generate 4 internal triangles

slide-30
SLIDE 30

N P t h N‐Patches

 Quadratic interpolation of normals used to

handle inflections

slide-31
SLIDE 31

C ti it Continuity

 When connecting Bézier patches points next to  When connecting Bézier patches, points next to

the boundary must be collinear to preserve C1

slide-32
SLIDE 32

C ti it Continuity

Discontinuous Continuous

slide-33
SLIDE 33

C ti it Continuity

 G continuity if points adjacent to shared corner  G1 continuity if points adjacent to shared corner

lie in a plane

 At patch corners vertical and horizontal control  At patch corners vertical and horizontal control

points must be spaced at equal rations for C1

slide-34
SLIDE 34

B i S li Basis‐Splines

 Offer Local Control  Can be expressed as Bézier curves  Suppress Error for many control points

Suppress Error for many control points

 Continuity controlled for any number of points*

slide-35
SLIDE 35

K t V t Knot Vectors

 Describe set of basis functions (from Cox‐de Boor)  Knot values can be repeated to reduce the span of a

basis function

 Need not be integer valued  Need not be integer valued

slide-36
SLIDE 36

K V N U if E l Knot Vectors: Non‐Uniform Example

slide-37
SLIDE 37

NURBS NURBS

 Knot vectors can take on values that are not

uniformly spaced

 Use Rational B‐Splines

slide-38
SLIDE 38

NURBS T t i NURBS Texturing

 Map parameters to texture [0,1]

p p [ , ]

 texcpts = [0, 0, 0, 1, 1, 0, 1, 1]

gluBeginSurface(globj); gluNurbsSurface(globj 4 U 4 V 4 2 texcpts 2 2 gluNurbsSurface(globj, 4, U, 4, V, 4, 2, texcpts, 2, 2, GL_MAP2_TEXTURE_COORD_2); gluNurbsSurface(globj n + p + 1 U m + q + 1 V 3 gluNurbsSurface(globj, n + p + 1, U, m + q + 1, V, 3 m, 3, cpts, p + 1, q + 1, GL_MAP2_VERTEX_3); gluEndSurface(globj); gluEndSurface(globj);

slide-39
SLIDE 39

S D Some Demos

Run Demos

slide-40
SLIDE 40

References

 Real‐Time Rendering by Tomas Akenine‐Möller, Eric

H i d N H ff f A K P L d 3 d Haines, and Naty Hoffman, from A.K. Peters Ltd., 3rd edition. L Piegl and W Tiller The NURBS Book (Monographs

 L. Piegl and W. Tiller, The NURBS Book (Monographs

in Visual Communication), 2nd ed.

 NURBS Textures Peter Salvi June 30 2008  NURBS Textures, Peter Salvi, June 30, 2008