09 - Designing Surfaces CSCI-GA.2270-001 - Computer Graphics - - - PowerPoint PPT Presentation

09 designing surfaces
SMART_READER_LITE
LIVE PREVIEW

09 - Designing Surfaces CSCI-GA.2270-001 - Computer Graphics - - - PowerPoint PPT Presentation

09 - Designing Surfaces CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo Triangular Surfaces A surface can be discretized by a collection of points and triangles Each triangle is a subset of a plane Every point on the surface can


slide-1
SLIDE 1

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

09 - Designing Surfaces

slide-2
SLIDE 2

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Triangular Surfaces

  • A surface can be discretized by a collection of points and triangles
  • Each triangle is a subset of a plane
  • Every point on the surface can be expressed as an affine

combination of three vertices

  • The surface is C0
slide-3
SLIDE 3

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Barycentric Coordinates

  • The points inside a triangle, are usually parametrized using barycentric

coordinates w:

  • The barycentric coordinates naturally defines a parametrization

v1 v2 v3 p

w1 w2 w3 px py

=

1 1 1 1 v1y v2y v3y v1x v2x v3x

slide-4
SLIDE 4

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Tensor Surfaces

slide-5
SLIDE 5

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Bilinear Interpolation

  • Linear interpolation
  • “Simplest” curve between two points
  • Bilinear interpolation
  • “Simplest” surface between four points

= 1 − u u ✓b00 b01 b10 b11 ◆ ✓1 − v v ◆

Domain Isoparametric curve

x(u, v) =

1

X

i=0 1

X

j=0

bi,jB1

i (u)B1 j (v)

slide-6
SLIDE 6

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Bilinear Interpolation

  • Linear interpolation
  • “Simplest” curve between two points
  • Bilinear interpolation
  • “Simplest” surface between four points

b01

00 = (1 − v)b00 + vb01

b01

10 = (1 − v)b10 + vb11

b00

11 = (1 − u)b01 00 + ub01 10

slide-7
SLIDE 7

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

b00 b10 b11 b20 b21 b23 b33 b13 b03

Bézier Patches

  • Build on Bézier curves
  • Control points as curves
  • Keep one parameter fixed: iso-parameter curves

bm(u) =

m

X

i=0

biBm

i (u)

bi = bi(v) =

n

X

j=0

bijBn

j (v)

bmn(u, v) =

m

X

i=0 n

X

j=0

bijBm

i (u)Bn j (v)

slide-8
SLIDE 8

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • Affine invariance
slide-9
SLIDE 9

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • Affine invariance
  • Repeated (bi-)linear combinations
  • Convex hull property
slide-10
SLIDE 10

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • Affine invariance
  • Repeated (bi-)linear combinations
  • Convex hull property
  • Partition of unity and non-negativity
  • Polynomial boundary curves and corner interpolation
slide-11
SLIDE 11

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • Affine invariance
  • Repeated (bi-)linear combinations
  • Convex hull property
  • Partition of unity and non-negativity
  • Polynomial boundary curves and corner interpolation
  • Variation diminishing
slide-12
SLIDE 12

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • Affine invariance
  • Repeated (bi-)linear combinations
  • Convex hull property
  • Partition of unity and non-negativity
  • Polynomial boundary curves and corner interpolation
  • Variation diminishing
slide-13
SLIDE 13

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

  • Bézier curves created by repeated linear interpolation
  • Surfaces: repeated bilinear interpolation
slide-14
SLIDE 14

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Demo

http://cagd-applets.webarchiv.kit.edu/mocca/html/noplugin/inhalt.html

slide-15
SLIDE 15

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

NURBS Surfaces

  • Standard in most advanced modeling systems

x(u, v) =

  • i
  • j wi,jdi,jN m

i (u)N n j (v)

  • i
  • j wi,jN m

i (u)N n j (v)

projection of tensor product patches ≠ tensor product surface! (basis is not separable)

slide-16
SLIDE 16

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

NURBS Surfaces

  • Standard in most advanced modeling systems
slide-17
SLIDE 17

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

NURBS Surfaces

  • Influence of weights
slide-18
SLIDE 18

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

NURBS Surfaces

  • Influence of weights
slide-19
SLIDE 19

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

NURBS Surfaces

  • Influence of weights
slide-20
SLIDE 20

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

NURBS Surfaces

  • Influence of weights
slide-21
SLIDE 21

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Subdivision Surfaces

slide-22
SLIDE 22

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Why?

  • Tensor product surfaces are defined on “regular grids”
  • They cannot be defined on arbitrary meshes
slide-23
SLIDE 23

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

A different way of constructing curves!

slide-24
SLIDE 24

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Interpolating: 4 point scheme

slide-25
SLIDE 25

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Interpolating: 4 point scheme

slide-26
SLIDE 26

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Interpolating: 4 point scheme

slide-27
SLIDE 27

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Interpolating: 4 point scheme

slide-28
SLIDE 28

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Catmull-Clark scheme

even

  • dd

Converges to cubic B-spline

slide-29
SLIDE 29

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Subdivision Methods

  • Principal characteristics:
  • triangular or quadrangular meshes
  • approximating or interpolating
  • smoothness of the limit surface
  • We will study 2 of them:
  • Loop subdivision for triangle meshes (Approximating, C2)
  • Catmull-Clark subdivision for quadrilateral meshes (Approximating, C2)
  • Other famous schemes (see the references for details)
  • Butterfly, Kobbelt, Doo-Sabin, Midedge, Biquartic
slide-30
SLIDE 30

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Loop subdivision

w(n) = 5 8 − (3 8 + 1 4cos2π n )2

slide-31
SLIDE 31

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Special stencils

  • Special stencils exist that allow to evaluate:
  • The limit position of a vertex: that is, in a single step you can compute the

position of one vertex after an infinite number of subdivisions

  • The tangent plane at a vertex: in this case, two stencils are used and each

stencil generates a vector that lies in the tangent plane

  • It is also possible to evaluate the surface analytically, in other words it is possible to

find the mapping between every point of the control mesh and the limit surface. For details see http://www.autodeskresearch.com/publications/loopsubdiv

slide-32
SLIDE 32

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Catmull Clark subdivision

β = 3 2N γ = 1 4N

On a regular grid, the Catmull clark subdivision is a collection of bicubic Bézier patches

slide-33
SLIDE 33

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Catmull-Clark

  • It is the standard in the animation industry
  • All the major 3D modeling softwares support it
  • Similarly to Loop:
  • stencils for the limit surface
  • stencils for tangent plane
  • it can be evaluated analytically
slide-34
SLIDE 34

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

How are they used in practice?

slide-35
SLIDE 35

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Efficient implementation

  • At every subdivision step, we add new vertices and move the existing ones

in new positions

  • Every position is computed as a weighted average of existing vertices
  • This means that the process is linear!
  • For a fixed number of levels of subdivision, the vertices of subdivided

surface can be computed as:

  • where S is a sparse and fixed matrix

p = Sq

Subdivided vertices Control vertices

slide-36
SLIDE 36

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

T-spline

  • Extension of splines for non-rectangular grids
  • http://www.youtube.com/watch?v=k1ro9S-cAwI
slide-37
SLIDE 37

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

References

Fundamentals of Computer Graphics, Fourth Edition 4th Edition by Steve Marschner, Peter Shirley Chapter 15 Curves and Surfaces for CAGD - Gerald Farin Subdivision Zoo - Denis Zorin http://www.cmlab.csie.ntu.edu.tw/~robin/courses/gm/note/subdivision-prn.pdf

slide-38
SLIDE 38

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Projective Transformations

slide-39
SLIDE 39

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Viewing Transformation

  • bject space

model camera projection viewport canonical view volume world space camera space screen space

slide-40
SLIDE 40

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Orthographic Projection

projection canonical view volume camera space x z y

(l,b,n) (r,t,f)

Morth =    

2 r−l

− r+l

r−l 2 t−b

− t+b

t−b 2 n−f

− n+f

n−f

1    

slide-41
SLIDE 41

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Perspective Projection

  • In Orthographic projection, the size of the objects does not change

with distance

  • In Perspective projection, the objects that are far away look smaller

Image Plane

ys y

d

z

ys = dy z

Image Plane

slide-42
SLIDE 42

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Divisions in Matrix Form

  • We would like to reuse the matrix machinery that we built in the

previous lectures

  • How do we encode divisions?
  • We extend homogeneous coordinates

ys y

d

z ys = dy z

Image Plane

slide-43
SLIDE 43

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

  • What do we have left?
  • We can use the last row of the transformation:

Until now…

  a1 b1 c1 a2 b2 c2 1   ·   x y 1   =   a1x + b1y + c1 a2x + b2y + c2 1     a1 b1 c1 a2 b2 c2 e f g   ·   x y 1   =   a1x + b1y + c1 a2x + b2y + c2 ex + fy + g   ∼

  

a1x+b1y+c1 ex+fy+g a2x+b2y+c2 ex+fy+g

1   

slide-44
SLIDE 44

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Intuition

  • Purely algebraic:
  • Or as a projection, where each line is

identified by a point on the plane z=1

  • Note that in this case, you can think of it

as a transformation in a space with one more dimension

  x y w   ∼   x/w y/w 1  

slide-45
SLIDE 45

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Projective Transformation

  • A transformation of this form is called a projective transformation (or a homography)
  • The points are represented in homogeneous coordinates

  a1 b1 c1 a2 b2 c2 e f g   ·   x y 1   =   a1x + b1y + c1 a2x + b2y + c2 ex + fy + g   ∼

  

a1x+b1y+c1 ex+fy+g a2x+b2y+c2 ex+fy+g

1   

slide-46
SLIDE 46

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Example

  • It transforms a square into a quadrilateral — note that

straight lines are preserved, but parallel lines are not!

  • Note that you can use homogeneous coordinates for

as many transformations as you want, only when you need the cartesian representation you have to normalize

0,0 1,1 0,0 3,0 1,3

M =   2 −1 3 2/3 1/3  

slide-47
SLIDE 47

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Perspective Projection

  • Perspective projection is easily implementable using this machinery

ys y

d

z

Image Plane

✓ys 1 ◆ ∼ ✓d 1 ◆ 0 @ y z 1 1 A

ys = dy z

slide-48
SLIDE 48

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

  • We will use the same conventions that we used for orthographic:
  • Camera at the origin, pointing negative z
  • We scale x, y and “bring along” the z

x z y

(l,b,n) (r,t,f)

P =     n n n + f −fn 1    

Perspective Projection

slide-49
SLIDE 49

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Effect on the points

x z y

(l,b,n) (r,t,f)

P =     n n n + f −fn 1    

P     x y z 1     =     nx ny (n + f)z − fn z     ∼    

nx z ny z

n + f − fn

z

1    

slide-50
SLIDE 50

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Effect on the points

x z y

(l,b,n) (r,t,f)

P =     n n n + f −fn 1    

P     x y z 1     =     nx ny (n + f)z − fn z     ∼    

nx z ny z

n + f − fn

z

1    

slide-51
SLIDE 51

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Orthographic Projection

projection canonical view volume camera space x z y

(l,b,n) (r,t,f)

Morth =    

2 r−l

− r+l

r−l 2 t−b

− t+b

t−b 2 n−f

− n+f

n−f

1    

slide-52
SLIDE 52

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Complete Perspective Transformation

P =     n n n + f −fn 1    

canonical view volume camera space

P

Morth

Morth =    

2 r−l

− r+l

r−l 2 t−b

− t+b

t−b 2 n−f

− n+f

n−f

1    

slide-53
SLIDE 53

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Parameters?

  • How to set the parameters of the transformation?
  • If we look at the center of the center of the window then the

barycenter of the front back should be at (0,0,f)

  • If we want no distortion on the image we need to keep a fixed

aspect ratio:

  • width/height = r/t (width and height are the size in pixels of the

final image)

  • There is only one degree of freedom left, the field of view angle :
  • The parameters can thus by found by fixing n and . You can then

compute t and consequently all the other parameters needed to construct the transformation

x z y

(l,b,n) (r,t,f)

θ tanθ 2 = t |n| θ θ

slide-54
SLIDE 54

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

References

Fundamentals of Computer Graphics, Fourth Edition 4th Edition by Steve Marschner, Peter Shirley Chapter 7