subdivision surfaces - new york universitydzorin/intro-graphics-f01/lectures/lecture9.pdf ·...

44
2001, Denis Zorin Subdivision Surfaces

Upload: others

Post on 27-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Subdivision Surfaces

Page 2: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

What makes a good scheme?

■ recursive application leads to a smoothsurface

Example: Loop Scheme

Page 3: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Example: Loop Scheme

Refinement rule

Page 4: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Two geometric rules:

■ even (update old points)

■ odd (insert new)

1

8

1

8

3

8

3

8

®

® ®

® ®

1¡n®

Example: Loop Scheme

Page 5: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Control Points

Vertices of initial mesh

■ define the surface

■ each influences finite part of surface

Page 6: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Triangles and Quads

Page 7: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Uniform splines

■ can be computed using subdivision

■ quartic box spline rules:

1

8

1

8

3

8

3

8

1

16

1

16

1

16

1

16

1

16

1

16

5

8

Subdivision and Splines

Page 8: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Subdivision and Splines

For splines, the control mesh is regular

Page 9: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Extraordinary Vertices

î~äÉåÅÉ=S î~äÉåÅÉ=Q

î~äÉåÅÉ=≠ S î~äÉåÅÉ=≠ Q

Triangle meshes Quad meshes

êÉÖìä~ê

Éñíê~çêÇáå~êó

Page 10: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

bñíê~çêÇáå~êóîÉêíáÅÉë

®

® ®

® ®

1¡ n®

_çìåÇ~êáÉë

1

8

3

4

1

8

1

2

1

2

`êÉ~ëÉë=ÉíÅK

Constructing the Rules

Start with spline rules

■ define rules for:

Page 11: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

■ invariance underrotations andtranslations

Constructing the Rules

■ smoothness andFairness

■ small support

Page 12: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Affine Invariance

íê~åëÑçêã

q

íê~åëÑçêã

q

ëìÄÇáîáÇÉ

ëìÄÇáîáÇÉ

Page 13: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Affine Invariance

1

8

1

8

3

8

3

8

®

® ®

® ®

1¡n®p =

Xaipi

Coefficients of masks must sum to 1

Xai(pi + t) =

³Xai

´t+ p

1

Çáëéä~ÅÉãÉåí

Page 14: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Boundaries

Three types of points:

■ convex/concave need different rules

ëãççíÜ ÅçåÅ~îÉÅçåîÉñÅçêåÉêë

Page 15: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Concave Corner Problem

Standard rule produces folds

■ special concave corner rule

Page 16: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Vertex Types

Four basic types

■ interior

■ boundarysmooth

■ convex

■ concave

Page 17: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Boundaries and Creases

Boundaries and creases are alike

■ boundary independent of the interior

1

8

3

4

1

8

ÄçìåÇ~êáÉë

1

83

4

1

8

ÅêÉ~ëÉë

1

2

1

2

1

2

1

2

Page 18: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Crease Examples

Page 19: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Subdivision Schemes

Primal Dual

■ (no interpolation)

fåíÉêéK^ééêçñK

`~íãìääJ

`ä~êâ

hçÄÄÉäí

iççé _ìííÉêÑäó

aççJp~ÄáåI

jáÇÉÇÖÉ

aóåJiÉîáåJiáì

EåçåJäáåÉ~êF

Page 20: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Loop Scheme: Boundaries

Extraordinary vertices not C1

■ rules of Hoppe et al.■ problem: depend on valence;

boundary is not a cubic spline.

■ fix: modify rules for interior neighbors

eçééÉ=Éí=~äK çìê=êìäÉë

Page 21: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Loop Scheme: Boundaries

3

8

5

8

1

8

1

8

3

8

3

8

eçééÉ=Éí=~äK çìê=êìäÉë

1

2

1

2

1

8

1

8

1

4

³1 + cos

¼

K

´1

1

4cos

¼

K

ëãççíÜ

Page 22: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Loop Scheme: Corners

Endpoint interpolation

■ interpolation rule for corner vertex

■ modified rules for odd vertices next to theboundary

■ concave corners require more…

Page 23: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Corner rules, 1st step

■ for convex, use

■ for concave, use

Loop Scheme: Corners

1

8

1

8

1

1

4cosµ

1

4(1+ cosµ)

µ <¼

K

µ >¼

K

Page 24: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Loop Scheme: Corners

Corner rules, 2nd step

■ really need it only for concave

■ “pull” the surface toward thetangent plane: add a combination oftangents

í~åÖÉåíë

Page 25: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Subdivision Schemes

Primal Dual

■ (no interpolation)

fåíÉêéK^ééêçñK

`~íãìääJ

`ä~êâ

hçÄÄÉäí

iççé _ìííÉêÑäó

aççJp~ÄáåI

jáÇÉÇÖÉ

aóåJiÉîáåJiáì

EåçåJäáåÉ~êF

Page 26: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Catmull-Clark Scheme

Primal, quadrilateral, approximating

■ tensor-product bicubic splines

1

649

163

32

1

64

1

64

1

64

3

32

3

32

3

32

1

16

3

8

3

8

1

16

1

16

1

16

1

4

1

4

1

4

1

4

Page 27: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Catmull-Clark Scheme

Reduction to a quadrilateral mesh

■ do one step of subdivision with special rules:only quads remain

Page 28: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Catmull-Clark Scheme

Extraordinary vertices

¯

K

°

K

1¡ ° ¡ ¯

° =1

4K

¯ =3

2K

¯

K

¯

K

°

K

°

K

Page 29: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Catmull-Clark Scheme

Boundaries, creases, corners

■ cubic spline (same as Loop!)

■ need to fix rules for C1-continuity

1

32

3

32

3

32

1

32

1

1

4cosµ

1

4(1 + cosµ)

Page 30: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Lighting model

Page 31: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Local lighting model

Describes interaction of the light with the surface.

Almost never truly based on physics: perceptionplays a greater role.

Visible light: electromagnetic waves, withwavelengths 400nm (violet) - 700nm (red);intensity can vary over many orders ofmagnitude.

Computer model: only three “frequencies”: RGB,

intensity varies over a small range, typically only255 discrete values/ color.

Page 32: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Physics vs. graphics

Computer graphics terms are somewhat confusingand disagree with physics:

Graphics: color of an object; physics: reflectionspectrum (i.e. fraction of light of each frequencythat gets reflected).

Graphics: intensity or color of a light ray; physics:radiance distribution (measured inwatts/steradian/meter2/meter)

Graphics: intensity or color of a point light source;physics: intensity spectrum of a point lightsource (almost in agreement!) measured inwatts/steradian/meter.

Page 33: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Illumination model

Two main components:

■ light source characteristics■ position

■ intensity for each freq. (color)often, different intensity can be specified fordifferent colors

■ directional distribution

■ surface properties■ reflectance for each freq. (color)

■ different reflectance can be specified for diffuseand specular light

Page 34: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Reflection geometry

surface

N: normal

L: direction to thelight source

V: directionto the eye

R: reflecteddiection

R = 2(N,V)N - V

Page 35: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Illumination components

In the model commonly used in graphicsapplications, there are several components

■ diffuse relection: intensity does not dependon the direction to the viewer

■ specular: simulates relective surfaces andspecular highlights depending on thedirection to the viewer

■ ambient: a crude approximation to theillumination created by the light diffuselyreflected from surfaces

Page 36: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Diffuse component

Diffuse surfaces are surfaces following theLambert’s law: the energy of the light reflectedfrom a surface in a direction D is proportional tothe cosine of the angle between the normal andD. As intensity (radiance) is proportional to theenergy times cross section of the ray, it does notdepend on the view direction, but is proportionalto the cosine of the angle between the normaland the direction to the light.

small area A

A cosθθθθθθθθ

Ldiff = kdiff(L,N)

Page 37: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Specular component

Specular component approximates behavior ofshiny surfaces. If a surface is an ideal mirror, thelight from a source reaches the eye bouncing ofa fixed point of the surface, only if the directionto the light coincides with the reflected directionto the eye:

N

V L=R ideal mirrorsphere

Page 38: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Specular reflection

For non-ideal reflectors, the reflection of the light isstill the brightest when L=R but decays, ratherthan disappears, as the angle between L and Rincreases. One way to achieve this effect is touse cosine of the angle to scale the reflectedintensity:

N

V

R

αααα

Lspec=kspec(R,L)p

Phong exponent

Page 39: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Specular reflection

p = 0 p = 1 p = 2

p = 10 p = 25 p = 100

Page 40: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Metal vs. plasitic

Natural look of metallic surfaces is difficult tosimulate, but the first approximation is obtainedusing proper highlight color.

For plastic objects, highlights are close in color tothe color of the light. For metals, to the color ofthe surface. Assuming white lights, for plasticset kspec=[c,c,c], where c is a constant, for moremetallic look set kspec= kdiff

plastic look metallic look

Page 41: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Ambient component

Not all light illuminating a surface comes from lightsources, or reflections of light sources in idealmirrors; however, the light diffusely reflectedfrom other surfaces is difficult to take intoaccount, especially for real-time rendering. It isapproximated by the ambient component: aconstant is added to all objects. To have morecontrol over ambient contribution, surfaces canbe assigned ambient reflectivity.

Lamb=kambIamb

Page 42: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Complete equation

( )R),(LkN),(LkIIkIlightsall

pispecidiffiambambtotal ∑ ++=

intensity ofi-th light

direction toi-th light

If we are ray tracing for rendering, in summation onlyvisible lights are present, and there are two additionalterms: contribution from the reflected ray andtransmitted ray. If we are using Z-buffering, then allactive light sources are regarded as visible.

Page 43: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

Attenuation

In real life, radiance reaching us from a light sourcedecreases with distance as 1/r2 (the stars aremuch less bright than the sun). However, due tothe nature of approximations used in graphics,the inverse-square law typically results inpictures that are too dark; the fix is to allow theprogrammer to control how fast the decay is.Ii in the formulas is replaced not by Ii/r2, asphysics suggest, but by

and the most common choice of constants is

a = 1, b = c = 0, that is, no attenuation!

2brbraIi

++

Page 44: Subdivision Surfaces - New York Universitydzorin/intro-graphics-f01/lectures/lecture9.pdf · Diffuse surfaces are surfaces following the Lambert’s law: the energy of the light reflected

2001, Denis Zorin

OpenGL model

Phong exponent called shininess. Several additions:

emmision;ambient, diffuse, specular light “intensities”

Setting material parameters (Kdiff,Kspec,Kamb,p)

GLfoat mat_diffuse[3], mat_spec[3], mat_amb[3];GLfloat shininess;

...glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);glMaterialfv(GL_FRONT,GL_SPECULAR,mat_spec);glMaterialfv(GL_FRONT, GL_AMBIENT,mat_amb);glMaterialf(GL_FRONT, GL_SHININESS,shininess);