2001, Denis Zorin
Subdivision Surfaces
2001, Denis Zorin
What makes a good scheme?
■ recursive application leads to a smoothsurface
Example: Loop Scheme
2001, Denis Zorin
Example: Loop Scheme
Refinement rule
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
2001, Denis Zorin
Control Points
Vertices of initial mesh
■ define the surface
■ each influences finite part of surface
2001, Denis Zorin
Triangles and Quads
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
2001, Denis Zorin
Subdivision and Splines
For splines, the control mesh is regular
2001, Denis Zorin
Extraordinary Vertices
î~äÉåÅÉ=S î~äÉåÅÉ=Q
î~äÉåÅÉ=≠ S î~äÉåÅÉ=≠ Q
Triangle meshes Quad meshes
êÉÖìä~ê
Éñíê~çêÇáå~êó
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:
2001, Denis Zorin
■ invariance underrotations andtranslations
Constructing the Rules
■ smoothness andFairness
■ small support
2001, Denis Zorin
Affine Invariance
íê~åëÑçêã
q
íê~åëÑçêã
q
ëìÄÇáîáÇÉ
ëìÄÇáîáÇÉ
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
Çáëéä~ÅÉãÉåí
2001, Denis Zorin
Boundaries
Three types of points:
■ convex/concave need different rules
ëãççíÜ ÅçåÅ~îÉÅçåîÉñÅçêåÉêë
2001, Denis Zorin
Concave Corner Problem
Standard rule produces folds
■ special concave corner rule
2001, Denis Zorin
Vertex Types
Four basic types
■ interior
■ boundarysmooth
■ convex
■ concave
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
2001, Denis Zorin
Crease Examples
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
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 çìê=êìäÉë
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
2¡
1
4cos
¼
K
ëãççíÜ
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…
2001, Denis Zorin
Corner rules, 1st step
■ for convex, use
■ for concave, use
Loop Scheme: Corners
1
8
1
8
1
2¡
1
4cosµ
1
4(1+ cosµ)
µ <¼
K
µ >¼
K
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
í~åÖÉåíë
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
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
2001, Denis Zorin
Catmull-Clark Scheme
Reduction to a quadrilateral mesh
■ do one step of subdivision with special rules:only quads remain
2001, Denis Zorin
Catmull-Clark Scheme
Extraordinary vertices
¯
K
°
K
1¡ ° ¡ ¯
° =1
4K
¯ =3
2K
¯
K
¯
K
°
K
°
K
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
2¡
1
4cosµ
1
4(1 + cosµ)
2001, Denis Zorin
Lighting model
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.
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.
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
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
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
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)
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
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
2001, Denis Zorin
Specular reflection
p = 0 p = 1 p = 2
p = 10 p = 25 p = 100
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
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
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.
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
++
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);