+ All Categories
Home > Documents > Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the...

Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the...

Date post: 01-Jun-2020
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
17
Level Set and PDE Methods for Computer Graphics Leopold K ¨ uhschelm * Sebastian Zambal Institute of Computer Graphics Vienna University of Technolgy Vienna / Austria Abstract The great idea behind level set methods is to describe prop- erties like density, velocity or color with a function over some domain (usually a region in 2D or 3D). Level sets al- lone are an inherently static concept. To allow modeling of dynamic processes, which means change of level set func- tions over time, partial differential equations (PDE) are in- troduced. We review basic principles and a few applica- tions of level set and PDE methods for computer graphics that have recently been proposed. Keywords: PDE, Level Set, Pattern Formation, 3D Curve Computation, Image Inpainting, 3D Shape Reconstruc- tion, Surface Editing, Fire Simulation, 3D Shape Morph- ing, Water Simulation, Fire Simulation 1 Introduction Level set methods are a very powerful concept for model- ing surfaces. The basic idea is to define a so called level set function over a region of interest. A usually smooth sur- face can then be determined as the set of points for which the level set function has a special value. Applications of pure level set methods range from blobby objects and gen- eral surface modeling [15] to methods for reconstruction and representation of 3D objects [6]. Although especially blobby objects have intensively been used for animations. Famous examples for use of blobby objects are blood floating in space in “The Wrath of Khan” and blobby objects in “Flubber”. it is hard to model realistic motion for such purposes. Motion always has to be added explicitly because the representation of objects takes no care of the underlying geometry. It is highly desirable to achieve models that do not only describe the geometry of objects but also handle their mo- tion. A lot of current research deals with this topic. Sug- gestions made so far involve principles of physics - espe- cially mechanics - and so it is not astonishing that partial differential equations (PDEs) play an important role. A lot of research has been done by Stanley Osher who devel- oped several mathematical models and corresponding nu- * [email protected] [email protected] merical algorithms that he applies to objects represented by level sets. However, not only dynamics of surfaces is gaining im- portance in computer graphics. Combined level set and PDE methods can also be applied to problems like image inpainting, morphing of images and 3D objects or texture generation. This paper gives an overview over the most important concepts, equations and some applications of level set methods in combination with PDEs. Chapter 2 explains some key terms of level sets. Chapter 3 briefly describes a few important basics about PDEs. The remaining chapters treat a few concrete applications of PDEs and level sets for computer graphics. 2 Level Sets A level set function ϕ(x) defines a value for each point x =(x 1 ,...,x n ) in a n-dimensional space. The point is that by the equation ϕ(x)=0 a surface Γ can be defined implicitly . The set of all x that fulfill this equation form the surface. In the following we give a list of important properties of level sets. 1. The boundary of a time dependent interface Γ(t) is formally defined by {x|ϕ(x, t)=0}. The region Ω(t) is bounded by Γ(t) and is the set of points for which {x|ϕ(x, t) > 0} and its exterior is defined by {x|ϕ(x,t) < 0}. 2. The gradient of the implicit function is defined as ϕ = ∂ϕ ∂x , ∂ϕ ∂y , ∂ϕ ∂z 3. The unit normal vector N to Γ(t) is given by N = - ϕ |∇ϕ| 4. The mean curvature κ of Γ(t) is defined by κ = -∇ · ϕ |∇ϕ|
Transcript
Page 1: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

Level Set and PDE Methods for Computer Graphics

Leopold Kuhschelm∗

Sebastian Zambal†

Institute of Computer GraphicsVienna University of Technolgy

Vienna / Austria

Abstract

The great idea behind level set methods is to describe prop-erties like density, velocity or color with a function oversome domain (usually a region in 2D or 3D). Level sets al-lone are an inherently static concept. To allow modeling ofdynamic processes, which means change of level set func-tions over time, partial differential equations (PDE) are in-troduced. We review basic principles and a few applica-tions of level set and PDE methods for computer graphicsthat have recently been proposed.

Keywords: PDE, Level Set, Pattern Formation, 3D CurveComputation, Image Inpainting, 3D Shape Reconstruc-tion, Surface Editing, Fire Simulation, 3D Shape Morph-ing, Water Simulation, Fire Simulation

1 Introduction

Level set methods are a very powerful concept for model-ing surfaces. The basic idea is to define a so called level setfunction over a region of interest. A usually smooth sur-face can then be determined as the set of points for whichthe level set function has a special value. Applications ofpure level set methods range from blobby objects and gen-eral surface modeling [15] to methods for reconstructionand representation of 3D objects [6].

Although especially blobby objects have intensivelybeen used for animations. Famous examples for use ofblobby objects are blood floating in space in “The Wrathof Khan” and blobby objects in “Flubber”. it is hard tomodel realistic motion for such purposes. Motion alwayshas to be added explicitly because the representation ofobjects takes no care of the underlying geometry.

It is highly desirable to achieve models that do not onlydescribe the geometry of objects but also handle their mo-tion. A lot of current research deals with this topic. Sug-gestions made so far involve principles of physics - espe-cially mechanics - and so it is not astonishing that partialdifferential equations (PDEs) play an important role. A lotof research has been done by Stanley Osher who devel-oped several mathematical models and corresponding nu-

[email protected][email protected]

merical algorithms that he applies to objects representedby level sets.

However, not only dynamics of surfaces is gaining im-portance in computer graphics. Combined level set andPDE methods can also be applied to problems like imageinpainting, morphing of images and 3D objects or texturegeneration.

This paper gives an overview over the most importantconcepts, equations and some applications of level setmethods in combination with PDEs. Chapter 2 explainssome key terms of level sets. Chapter 3 briefly describes afew important basics about PDEs. The remaining chapterstreat a few concrete applications of PDEs and level sets forcomputer graphics.

2 Level Sets

A level set functionϕ(x) defines a value for each pointx = (x1, . . . , xn) in a n-dimensional space. The point isthat by the equationϕ(x) = 0 a surfaceΓ can be definedimplicitly . The set of allx that fulfill this equation formthe surface.

In the following we give a list of important properties oflevel sets.

1. The boundary of a time dependent interfaceΓ(t) isformally defined by~x|ϕ(x, t) = 0. The regionΩ(t) is bounded byΓ(t) and is the set of points forwhich ~x|ϕ(x, t) > 0 and its exterior is defined by~x|ϕ(~x, t) < 0.

2. The gradient of the implicit function is defined as

∇ϕ =(∂ϕ

∂x,∂ϕ

∂y,∂ϕ

∂z

)

3. The unit normal vector~N to Γ(t) is given by

~N = − ∇ϕ|∇ϕ|

4. The mean curvatureκ of Γ(t) is defined by

κ = −∇ ·(∇ϕ|∇ϕ|

)

Page 2: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

5. Splitting and merging is performed by the implicitfunction automatically. It is not neccessary to explic-itly determine and keep track of splitting and mergingof boundaries. Considering this, level set methodsare a powerful alternative to parameterized represen-tations of surfaces and curves.

6. Motion of a level set surfaceΓ according to a veloc-ity field ~v can be expressed by changing the level setfunctionϕ according to

∂ϕ

∂t+ ~v · 5ϕ = 0. (1)

Equation (1) was introduced by Osher [12]. It is the basisfor many algorithms that handle level set dynamics.

2.1 Modeling With Level Sets

Historically implicit models are represented using linearcombinations of (often radial) basis functions. These ba-sis functions usually have several parameters like positionin 3D and size. Typical models contain from several hun-dred to several thousands of such primitives. The strategyof these “blobby” models was proposed in [3]. However,problems arise when one wants to perform a local defor-mation of a modeled surface. When the parameters arechanged this can have unwanted effects to other domainsof the surface. Such effects can be avoided when basisfunctions with very short radius are used. The problem ofthis is that a very high number of centers is needed.

The strategy of most implementations described so faris the use of a simple cartesian grid. Each node in the gridstores a discrete value of the implicit function and proper-ties of the curve like gradient and curvature are computedvia central differential operators and the like. Values ofthe level set function between nodes of the grid are sim-ply interpolated. This approach has the advantage that thetopology of the underlying surface is not an issue. Positiveis also that well studied numerical techniques can be usedand simple, accurate, robust and elegant implementationsare derived.

2.2 Reinitialization

In order to avoid numerical instability it usually is requiredthat the level set functionϕ does not become too steepor too flat around an interesting domain like a surfaceΓ.When considering dynamic processes, mechanisms mustbe introduced to guarantee this property ofΓ near the sur-face. In general we wishϕ to be the function that givesthe absolute distance from a point to the surface. Formallythis claim can be written as|∇ϕ| = 1. Many algorithmsworking with dynamic level sets do a reinitialization everyfew time steps to restore this property.

3 Partial Differential Equations

Partial differential equations exist in a great variety, soit is not possible to find a single method or algorithm tosolve all PDEs, but there are some analytical and numer-ical algorithms (e.g. finite difference method, finite ele-ment method) for solving special PDEs. Partial differen-tial equations are for instance extensively used in physicsto describe processes in dynamic systems. In many cases,solutions exist only if some of the parameters lie in a spe-cific set (e.g. the set of integers). We can distinguish be-tween linear and non linear PDEs. The linear ones areeasier to solve and are better explored, than the non linearequations.

The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of secondorder partial differential equations we can distinguish be-tween three types:

1. The elliptic equations are PDEs like the Laplaceequation

∂2u

∂x2+∂2u

∂y2= 0, (2)

which applies to potential energy functionsu =u(x, y) for a conservative force field in the plane. Themore general version of this problem is the poissonequation:

∂2u

∂x2+∂2u

∂y2= f (3)

2. The parabolic equations are PDEs like the heat equa-tion

∂2u

∂x2+∂2u

∂y2=∂u

∂t, (4)

which applies to the temperature distributionu(x, y)in the plane when heat is allowed to flow from warmareas to cool ones.

3. The hyperbolic equations are PDEs like the waveequation

∂2u

∂x2+∂2u

∂y2=∂2u

∂t2, (5)

which applies to the heightsu(x, y) of vibratingmembranes and other wave functions.

Corresponding to the initial value problem of the ordi-nary differential equations, PDEs are usually solved due toboundary conditions. For the heat equations, for instance,we can distinguish between three different boundary con-ditions:

1. Dirichlet Condition:

u = f1 on ∂Ω (6)

The temperature is fixed at the boundary.

Page 3: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

2. Neumann Condition:

−k∂u∂ν

= f2 on ∂Ω (7)

The heatflow over the boundary is fixed.

3. Robin Condition:

−k∂u∂ν

= αu+ f2 on ∂Ω (8)

The heat flow over the boundary is proptional to thedifference of the temperature between both sides ofthe boundary.

3.1 Navier-Stokes equation

The first serious approach of mathematically describingthe motion of fluids was done by Leonhard Euler. He setup the Euler equation which describes motion of ideal flu-ids,

∂u

∂t= −~u · ∇~u− 1

ρ∇p, (9)

whereu is the velocity field of the liquid,p is the pressureandρ is the density of the fluid. It is assumed that densityis constant.

The Navier-Stokes equations are an extension of the Eu-ler equation in the sense that they do include viscosity.

Viscosity can be defined as internal friction of a fluid.Friction is a force acting against the travel direction of theparticles of the fluid, so the unit of friction can be definedas Newtonmeter [Nm]. This frictional force scales withthe surface area of the particle (inm2),which brings usto Nm/m2. When a particle moves one meter it has toworkNms/m3, multiplying this by time to get to power,we end up withNms/m3, which simplifies toNs/m2,which is the unit for viscosity. For a better understandingof viscosity here some values of materials of everyday-use:

glass 1037

honey 10−2

oliveoil 10−3

air 10−5

water 10−6

The Navier-Stokes equations were first set up by ClaudeNavier around 1820 and refined by George G. Stokesaround 1845. The first Navier-Stokes equation expressesthe fact that the described fluids are incompressible. Thatsimply means that mass of a fluid must be constant. Thiscan be written as following equation:

∇ · v = 0, (10)

where v is a velocity field. The second Navier-StokesEquation is an extension of the Euler equation (9), whichadditionally coups with the viscosity of fluids:

∂v

∂t+ (v · ∇)v = −∇p

ρ+ ν∇2v (11)

In R3 this system of equations (first and second Navier-Stokes equation) is a non-linear system of 4 equations:the first Navier-Stokes equation and the derivatives of thethree coordinate directions. It is non-linear because wehave∇2. To fully determine this system we have to setstart and boundary conditions (e.g. a proper boundarywould bev = 0 for a non moving object in our velocityfield).

3.1.1 Physical Interpretation

The first two terms of the second Navier-Stokes equa-tion are the derivation of the velocity field and model thechange of the impulse of a particle in this field. On theright side we have the inner pressure and friction force. Ata closer look we can identify the term ”−∇p” means thatthe particle always flows from regions of higher higherpressure to the ones of lower pressure. And the secondterm on the right side identifies change of acceleration,which results from the viscosity of the medium.

With the Navier-Stokes equation system we can solve agreat variety of fluiddynamic problems: flow around ob-jects(e.g. cars, planes in subsonic, etc.), waterflowdynam-ics, dynamics in liquid metalls,etc.

4 Pattern Formation and TextureGeneration

Using textures is an important and well known techniqueto gain visual richness for computer generated imageswithout adding extra geometry for details on surfaces. Intraditional applications, images or real world photographsare used as textures mapped to polygons. Such casesnowadays can be handled very well and fast. On the otherhand, there are situations where traditional texture map-ping techniques are hardly applicable. Covering a three-dimensional object with a continuous high-quality texture,for example, is still a challenge. In this chapter we de-scribe the use of PDE and level set methods for generationand mapping of textures that meet some demands of ad-vanced texturing.

Fractal or stochastic methods are often used for texturegeneration. Another, very interesting approach is to followprinciples of biology. This approach is motivated by sim-ply taking a look at the richness of patterns that appear inbiology. Simple examples are spotted and striped coats ofcats, zebras and giraffes, the markings on certain butterflywings and even the human fingerprint. The idea is to usebiologically motivated models to simulate pattern forma-tion processes. Such models often arise from local, non-linear interactions of excitation and inhibition of chemicalsubstances usually referred to as morphogens. The con-centration of morphogens are represented by nothing elsethan by level set functions and the flow of these chemi-cals can be described with partial differential equations.

Page 4: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

Alan Turing first proposed such a model, called reaction-diffusion in [13]. This model will be the starting point forour discussion.

4.1 Reaction-Diffusion Basics

The basic principles for reaction-diffusion are diffusion,dissipation and reaction. Diffusion governs the trans-port of morphogens from points of higher concentrationto points of lower concentration. Dissipation involves thebreakdown of morphogens, causing concentrations, in ab-sence of other influences, to decay exponentially towardzero. Reaction finally governs the rate of morphogen pro-duction. The combination of these three processes resultsin the time derivative of concentration.

Since we are interested in generating surface textures,we assume throughout that diffusion occurs in a two-dimensional medium. Considering this we can denote theconcentration of a special morphogen asC(x, y). Theequation describing the derivation of morphogen concen-tration through time is

∂C

∂t= a2∇2C − bC +R, (12)

wherea is the rate constant for diffusion,b is the rateconstant for dissipation and the functionR is the reactionfunction forC. R can depend on the concentrations of allother morphogens. The three terms on the right hand sideof (12) represent diffusion, dissipation and reaction.

What we described so far, is the analytical descriptionthat typically leads to a PDE. In practice a grid is used torepresent the concentrations of morphogens. To be able tocomputedC

dt we need to approximate∇2 by a finite dif-ference. To do so, first the second finite difference in anyspace direction has to be computed. Forx we get

∂2C

∂x2≈ Ci+1,j + Ci−i,j − 2Ci, j

h2

wherei andj are the array subscripts and h is the distancebetween adjacent samples. Approximation of∂2C

∂y2 can bedone in the analogous way. Summing then leads to thediscrete Laplacian

∇2Ci,j ≈Ci+1,j + Ci−1,j + Ci,j+1 + Ci,j−1 − 4Ci,j

h2

The discrete Laplacian can also be written as the convolu-tion of the concentration array with a matrix

L =1h2

0 1 01 −4 10 1 0

.This form offers the advantage that any additional termsthat are linear functions ofCi,j and its neighbours mayreadily be combined to form a single3 × 3 mask. Mul-tiplication of the Laplacian bya2 and including the term

−bCi,j gives

M =1h2

0 a2 0a2 −4a2 − h2b a2

0 a2 0

, (13)

which leads to another notation of (12)

∂C

∂t= M ∗ C +R,

where “∗” denotes discrete convolution.To compute a pattern after some time we must integrate

∂C∂t through time. This can be realized by summation of

values for discrete time steps. For example, the simpleEuler method could be applied to develop a pattern overtime.

4.2 Two-Chemical Systems

The simplest types of reaction diffusion systems are theones with only two different morphogens A and B. To getan idea of how reaction-diffusion in general works it isuseful to have a look at such two-chemical systems.

Turing himself proposed a specific one-dimensionaltwo-chemical system for generation of spots. Since thissystem is one-dimensional, it can be modeled as an assem-bly of discrete cells along a line. The equations definingits behaviour describe the change of concentrations in thecells:

∂Ai

∂t= ad (Ai+1 +Ai−1 − 2Ai) + s (16−AiBi)

∂Bi

∂t= bd (Bi+1 +Bi−1 − 2Bi) + s (AiBi −Bi − βi)

Ai andBi are the concentrations of morphogen A andmorphogen B in celli. ad and bd represent the diffu-sion rates of A and B. Witkin and Kass simulated this sys-tem and presented their results in [16]. We will give anoverview over their conclusions here.

The first task before starting the simulation is to initial-ize the system. This is done by assigning a constant valueof concentration 4 to all of the 60 cells for A as well asfor B. The diffusion constants are set toad = 0.25 andbd = 0.0625. The parameters is initialized with 0.03125.The parameter settings described so far lead to a stablesystem where all concentrations do not change in time. Tostart a more complex process, the variablesβi are intro-duced, which randomly vary by±0.05 from 12. The de-velopment of concentration of morphogen B in timestepsof 400 is shown in figure 1. At first, concentrations differby small amounts. Then the system starts to behave un-stable. However, after some time it is driven to a stablestate. The small values of concentrations of B now can beinterpreted as one-dimensional spots.

Of course reaction-diffusion is not restricted to one di-mension. It can easily be extended to two and three dimen-sions. To gain a texture for a spotted surface one simplyneeds to adapt the system described above for two dimen-sions.

Page 5: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

Figure 1: One-dimensional example of reaction-diffusion.Reprinted from [16]

4.3 Complex Patterns

So generating dotted surfaces can be done using reaction-diffusion. But what about really complex patterns? Gener-ating richer patterns requires refinement and extension ofthe simple reaction-diffusion process. A lot of proposalshave been made how this can be achieved.

4.3.1 Anisotropic Diffusion

One possible way to increase flexibility of reaction-diffusion is to assign different diffusion rates in differentdirections of the coordinate axes. This is referred to asanisotropic diffusion and allows oriented pattern typicalof zebra stripes and sand dunes.

Of course it is desireable not only to vary the diffusionin directions of the coordinate axes of the system but tochange diffusion in any direction. This can be achievedby rotation of the coordinate system before assignment ofdiffusion rates. It can be shown that this rotation leads toan extended form of equation (13),

M =1h2

−a12 2a22 a12

2a11 −4(a11 + a22)− 2h2b 2a11

a12 2a22 −a12

,(14)

wherea11, a12 and a22 can be determined by definingan angleφ about which the coordinate system for thediffusion-rates is rotated relative to the original coordinatesystem. For a more detailed description see [16].

It is also possible to achieve patterns that have differentspatial alignments at different parts of the underlying sur-face. To generate such patterns, space-varying diffusioncan be applied by setting up a diffusion map. That is adata structure which for each position stores the angleφand the diffusion ratesa1 anda2 along the principal direc-tions after rotation. A similar strategy can be applied toachieve time varying patterns.

4.3.2 Cascaded Reaction-Diffusion

The idea behind cascaded reaction-diffusion is to gener-ate an initial pattern with reaction-diffusion and to refinethis pattern with another reaction-diffusion process that isgoverned by different parameters. Additionally, parts gen-erated by the first process might be frozen before the sec-ond process starts.

Greg Turk shows how the pattern of a cheetah could begenerated by applying such a technique [14]. The coatof a cheetah consists of larger and smaller points that donot swap. In the first reaction-diffusion process the big-ger spots are generated using high diffusion rates. Theregions representing spots that emerge are frozen and af-ter then the second process is started. In this second pro-cess, lower diffusion rates are used and so the created spotsare smaller. To consider the concentrations of the firstreaction-diffusion has the effect that the new smaller spotsdo not overlap with the old bigger spots.

4.4 Effective Solution Methods

A simple method to evolve the reaction-diffusion processis to use the Euler method. This can be done by usingdiscrete time steps∆t. Computation of change of concen-trations can then be computed by

Ct+∆t(x, y) = ∆t(M ∗Ct(x, y)+Rt)+Ct(x, y), (15)

where “∗” denotes discrete convolution ofCt with M .One way to speed up the process is to use a multi grid.

Not just a grid with fixed resolution is used but a combi-nation of grids with different resolutions. This method re-quires complex control strategies to switch from one gridsize to another. However Witkin and Kass [16] mentionthat useful results can be achieved by starting with thecoarsest grid able to resolve details of a pattern. A fixednumber of iterations is done on this coarse grid. The re-sults are then interpolated to a finer grid. These steps arerepeated several times until the final high resolution pat-tern emerges.

A more complex speed-up strategy, which we only men-tion here, is to partly solve equation (15) analytically. Byignoring reaction, henceRt = 0, the solution of the equa-tion can be written as

Ct+∆t(x, y) = Ct(x, y) ∗G∆t(x, y)

G∆t(x, y) can be computed explicitly and is known as theGreen’s function of the differential equation. In this casedifferent diffusion ratesa1 and a2 only along the fixedprincipal axes of the coordinate system are accepted.

This analytical approach leads to much better solutionsthan the Euler method. Greater time steps can be madeto achieve equal quality which leads to a great speed-up.However we have not considered reactionR so far whichmakes the situation a little complicated. Since we want togive only an idea of this method incorporation of reaction

Page 6: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

will not be discussed here. For more information about itsee [16].

4.5 Mapping onto surfaces

In 2D a cartesian grid can be used to do reaction-diffusion.The important information supplied by this grid is whichcells are adjacent to the currently considered cell andwhich concentrations of morphogens do these adjacentcells have. The method can be extended to non-planar sur-faces represented by polygon meshes. Such a mesh con-tains the neccessary information about adjacency of nodes.With this information the texture can directly be generatedon the mesh. The great advantage of this strategy is thatno texture coordinates must be defined on the nodes of themesh and distortion of textures does not have to be consid-ered.

5 3D Curve Computation

The dimension of an object plus its codimension equalsthe dimension of the space, the object resides. Level setmethods are traditionally used for modeling curves in 2Dand surfaces in 3D. These are objects of codimension one.There are attempts to modify level set methods to be ableto handle objects of higher codimension. Especially one-dimensional objects in 3D (curves in space which havecodimension two) are interesting. They can be used tomodel phenomena like smoke rings. As is the case for alllevel set methods, splitting and merging is done implicitly.

5.1 Geometric Representation

A curve in 3D - an object of codimension 2 - can be de-scribed by a system of two level setsφ andψ. The curve isdefined as the set of points for whichφ = ψ = 0. In otherwords, the curve is the intersection of two surfaces. Mo-tion of the curve is simply modeled by motion of the levelsetsφ andψ. Later we will examine geometry-dependentmotion of curves. To do so, we first show how basic geo-metric quantities of the curve can be computed.

To find the tangent vectorT , we notice that∇φ ×∇ψ,computed at a point on the curve, is tangential to the curvein that point. Division by the length of the computed vec-tor gives the normalized tangent vector

~T =∇φ×∇ψ|∇φ×∇ψ|

.

Since we are dealing with a curve in 3D and hence havean entire plane normal to the curve at a specific point, find-ing a normal vector is not as easy as it is with surfaces in3D. The normal vector is defined to be the vector that lieson the intersection of the normal plane (generated by thenormals ofφ andψ) and the tangential plane (given byTand the direction of its derivation). Because the change of

the tangent vector is included, the length of the computedvector is the curvatureκ

κ ~N = ∇~T .

The normal vector,~N , now can easily be computed bynormalization ofκ ~N

~N =κ ~N

|κ ~N |.

The binormal is the vector normal to~T and ~N

~B = ~T × ~N.

Finally, the normal vector weighted with the torsion canbe derived as

τ ~N = −∇ ~B.

5.2 Motion Based on Geometry

Motion of the curve, depending on a velocity field~v, canin general be expressed by two equations describing themotion of both level setsφ andψ that are needed to definethe curve.

∂φ

∂t+ ~v · 5φ = 0

∂ψ

∂t+ ~v · 5ψ = 0

To write down the evolution equations for any type of mo-tion we can replace~v by any other expression. Since wewant to consider the case where motion depends on thecurvatureκ of the curve we replace~v by κ ~N which leadsto

∂φ

∂t+ κ ~N · 5φ = 0

∂ψ

∂t+ κ ~N · 5ψ = 0

It can be shown that this kind of motion equals a gradi-ent descent minimization of the length of the curve. Thelength of the curve, according to [11] can be expressed as

L(φ, ψ) =∫

R3|∇φ×∇ψ|δ(φ)δ(ψ)d~x.

whereδ is the dirac function.In [5] some other principles are suggested, by which

curves can be moved. Possibilities range from motion inthe normal direction at unit speed (~v = ~N ) to motion inbinormal direction at unit speed (~v = ~B) or motion by tor-sion in the normal direction (~v = τ ~N ). Also combinationslike motion in normal direction with only some curvatureflow (~v = ~N + εκ ~N ) can be applied. The last approachresults in motion mainly in direction of the normal. Theincorporation ofεκ ~N assures that no sharp kinks appear.

Page 7: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

5.3 Numerical Considerations

Again finite differences are used for evolving the level setfunctions. A grid is used for discretization of space. Fordiscretization of time a variation of third order Runge-Kutta integration was proposed in [5]. In cases where|~T | = 0 and|κ ~N | = 0 division by zero must be avoidedby adding small positive values to the denominator.

Ambrosio and Soner [1] used the squared distances tothe curve as level set functions. In other words the levelset functions had only positive values and the zero levelsets are the minima of the level set functions. The prob-lem with this approach is that splitting and merging of thecurve does not work correctly. The curve can develop aninterior which results in a “thickening” of the curve

To increase speed and lower memory usage it is sug-gested that the equations are not solved everywhere inspace. It increases efficiency to use a more local method.One possible approach is to reinitializeψ with signed dis-tances only in a neighborhood of its zero level set, as isdone in many level set algorithms. In a second step,φ isreinitialized with signed distances, but only along the in-teresting area around the surface ofψ. In the third stepφis made perpendicular to the zero level set ofψ. All thistogether allows to localize computations. For a detaileddescription of this algorithm see [5].

6 Image Inpainting

Image inpainting is a technique to modify an image in away that it is undetectable for an observer, who does notknow the original image. There are various applicationson image inpainting (e.g. to reconstruct missing parts (seeFigure 3 and 4) or to remove objects from an image). Inthis chapter we will introduce some basic methods for fill-ing in the regions to be inpainted based on partial differen-tial equations and level sets.

6.1 The digital inpainting algorithm

First we need a defined regionΩ to be inpainted. Theboundaries of this region can be processed by differenti-ation of this region∂Ω. Before we will go into the deepmathematical concepts we will show the algorithm in anabstract way: (1.) The surrounding image determines whatwe need to fill in so that the image “looks good”. So ourtask is to continue the surrounding of the image intoΩ.(2.) We need to process small regions insideΩ to achievegood results. This is achieved by processing contour lines.So we progressively close the gapΩ by processing fromthe boundary inwards. Now we need to specify this ab-stract algorithm in a mathematical context.

Let I0(i, j): [0,M ]×[0, N ] → R, with [0,M ]×[0.N ] ⊂N ×N, be a discrete 2D gray level image and i, j the co-ordinates of a point of this image. The algorithm producesa set of imagesI(i, j, n): [0,M ] × [0, N ] ×N → R such

thatI(i, j, 0) = I0(i, j) andlimn→∞ I(i, j, n) = I(i, j),which is the output image of the algorithm. We can writethis algorithm in the following form:

In+1(i, j) = In(i, j) +4tInt (i, j),∀(i, j) ∈ Ω (16)

where n denotes the progression of the algorithm,4t therate of improvement,In

t the update method,In the currentimage andIn+1 the improved one. Now we need to designthe update processIn

t .As we described before we need to propagate infor-

mation from outsideΩ into the gap (see point (1.)). LetLn(i, j) be the information, that we want to propagate and~Nn(i, j) be the direction, in which we want to do so. Nowwhat we really want to measure is the change of the infor-mation along~N , which we can compute in the followingmanner:

Int (i, j) = δ~Ln(i, j) · ~Nn(i, j), (17)

where δ~Ln(i, j) measures the change of informationLn(i, j). If δ~Ln(i, j) · ~Nn(i, j) = 0 we have propagetedL in ~N .

The next thing we have to express is the propagation ofthe information L in the direction~N , so we must derivethe vector~N . One direct approach will be to define~N asnormal to∂Ω. What happens is that we get an image inΩ,that is mostly oriented on the face of the regionΩ and noton the isophotes - lines of same intensity - of the image(see Figure 2).

Figure 2: On the left image you can see the white inpaint-ing regionΩ. On the right image is shown what happensif we use the wrong propagation direction. [2]

The problem is how to derive these isophotes: Thegradient∇In(i, j) gives the direction of the largest spa-tial change in the intensity at (i,j), so we can derive theisophotes as a90 rotation of this vector:∇⊥I(i, j)

As the propagation should be smooth we additionallyneed some smoothness operator to compute our informa-tion Ln - a good choice here is the Laplacian operator,which means:L = ∆In(i, j).

Now we are nearly finished, at last we can express thisalgorithm as a second order partial differential equation:

It = ∇⊥I · ∇∆I (18)

In a second step we can add anisotropic diffusion to thealgorithm to get a smoother image:

It = ∇⊥I · ∇∆I + ν∇ · (g(|∇I|)∇I), (19)

Page 8: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

whereν is the anisotropic diffusion and g is some smooth-ness function. This means that creating a proper inpaintingis analog to computing a steady state solution of (19). Forν = 0 we get the following equation:

∇⊥I · ∇∆I = 0 (20)

6.2 Analogy to transport of vorticity inincompressible fluids

Incompressible Newtonian fuids are governed by theNavier-Stokes equations (see also section 3.1), which cou-ple the velocity vector field~v to a scalar pressure p:

vt + v · ∇v = −∇p+ ν∆v, ∇ · v = 0 (21)

In two space dimensions, the divergence free velocityvector field~v posseses a stream functionΨ, which satisfies∇⊥Ψ = v. Additionally in 2D the vorticityω = ∇ × vsatisfies a simple advection diffusion equation:

wt + v · ∇ω = ν∆ω (22)

In 2D we can express the vorticity byw = ∇Ψ. If theviscosityν = 0 we can compute a steady state solution of(22), which must satisfy

∇⊥Ψ · ∇∆Ψ = 0. (23)

Now the analogy should be clear: the stream functionof inviscid fluids in 2D satisfies the same equation as thesteady state image intensity equation (20). Now we canmatch properties of the Image intensity method to theNavier-Stokes based method:

Navier − Stokes Image inpainting

stream functionΨ image intensity Ifluid velocity v = ∇⊥Ψ isophote direction ∇⊥Ivorticity ω = ∆Ψ smoothness w = ∆Ifluid viscosity ν anisotropic diffusion ν

Instead of solving a transport equation for I as in(4), we solve a vorticity transport equation for w:

∂w

∂t+ v · ∇w = ν∇ · (g(|∇w|)∇w) (24)

The image intensity is retrieved by solving the Poissonproblem

∆I = w, I|∂Ω = I0. (25)

There are several advantages to using the Navier-Stokesmethod. First, there is a well-developed theoretical andnumerical literature for this problem. Second we can com-pare this method to a number of other methods on fluiddynamics. Finally the transport in fluids is easier to under-stand, than the information flow in an image.

Figure 3: Here you see the distorted image [2]

Figure 4: And that is the image after restauration [2]

7 3D Shape Reconstruction

A common problem in computer graphics is to reconstructa smooth surface from several known points. The simplestway to approximate the surface would be linear interpola-tion. However this would not result in a smooth surface.

The approach of [17] we want to describe here uses alevel set representation and an iterative convergence to thereconstructed surface. The main idea is to find an initialapproximation of the surface and then let it “flow” towardsthe given data points. Three topics have to be consideredto realize such an algorithm.

First, one needs to compute a distance functionbeetween points in space and originally given data points.Second, an initial surface has to be found. In the third step,the approximation or flow of the initial surface towards thegiven points has to be carried out.

7.1 Distance Function

The distance from a pointx on the current surface to thegiven data points is calledd(x). d(x) is the distance be-tweenx and the point from the data set closest tox. Laterin the algorithmd(x) has to be evaluated for many points.So it is desireable to computed(x) very fast. An efficient

Page 9: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

implementation can be achieved using a grid that storesd(x) for each point in the grid. The question however is,how to compute values for the grid. An efficient methodis to start with the grid points that surround the given datapoints. These grid points are assigned the exact amount oftheir distance to the data point. An iterative process thenmoves away from these points and computes the distancesfor all other grid points. For a detailed description see [5].

7.2 Initial Solution

Generally, any surface that does not enclose the given datapoints can be used as initial solution. However if the re-gion bounded by this initial surface is much larger thanneccessary, the iteration process will need a lot more itera-tions which would lead to an unneccessary long executiontime. A possible solution would be to let the user choosean initial solution.

Since we are more interested in the iterative refinementof the surface, we do not discuss this topic here in detail.For more information we refer to [17] in which the authorsrepresent a special algorithm for finding a good initial so-lution.

7.3 Iterative Refinement

We denote the surface we refine at every step asΓ and theset of original data points asS. A refinement step actuallyis supposed to do nothing else than to decrease the differ-ence betweenΓ andS while at the same time the smooth-ness ofΓ should not be destroyed. Since we representΓas the zero level set of a level set functionφ, the centralquestion is, how to updateφ in each refinement step.

The iterative refinement is implemented as gradient de-scent process. An energy function is defined that mea-sures the quality of a solution. The smaller the value ofthis function, the better the solution. The key problem isto find such an energy function that considers the distancebetweenΓ andS as well as the smoothness ofΓ. Twoapproaches have been proposed [17]:

1. The weighted minimal surface model uses an energyfunctionE that represents the quality of the currentsollution:

E(Γ) =[∫

Γ

dp(x)ds] 1

p

(26)

The smaller the energy function, the better the sollu-tion. So the refinement can be realized as a gradientdescent process forE. It can be shown that the gra-dient flow ofE is

∂Γ∂t = −

[∫Γdp(x)ds

] 1p−1

dp−1(x)·[∇d(x) · n+ 1

pd(x)κ]n

(27)

Equation (27) describes the change ofΓ, but what weneed is the change ofφ. It can be shown that the

change ofφ that corresponds to the above update ofΓ is

∂φ∂t = 1

p |∇φ|[∫dp(x)δ(φ)|∇φ|dx

] 1p−1∇·[

dp(x) ∇φ|∇φ|

](28)

2. The convection model does not provide an explicitenergy function but simply suggests to use the fol-lowing gradient forΓ:

∂Γ∂t

= −∇d(x) (29)

The update forφ according to (29) can be determinedas

∂φ

∂t= ∇d(x) · ∇φ. (30)

Again φ is represented by a simple grid and quantitieslike the gradient and the like can be computed numericallywith discrete methods. Both the weighted minimal sur-face model and the convection model have advantages anddisadvantages. The convection model is simple and fastbut produces results close to a piecewise linear approx-imation. The weighted minimal surface model is morecomplicated and computationally expensive, but also re-constructs a smooth visually appealing surface. This is notastonishing since equation (27) includes the curvature ofΓ which is not the case for equation (29).

8 Surface Editing

We will present here a method of surface editing with thehelp of partial differential equations and level sets. Butfirst we take a short look on the surface editing methods ofpolygonal and parametric surfaces to identify some prob-lems of this approach. For example, it is difficult to guar-antee that mesh-models will not self-intersect when we dosome local operations based on vertices or control points.So we get physically wrong results. A second problemcomes up when we put two meshes close to each other. Insuch a case, parallel patches will produce errors. We willuse level sets to overcome these problems, because levelset models can easily change their topology and are freeof edge connectivity and mesh quality problems. Level setand other volumetric models become more important dueto the increasing use of volumetric scanning systems.

8.1 Level Set Surface Modeling

Level set models are deformable implicit surfaces thathave a volumetric representation. They are defined as isosurfaces (level set) of an implicit functionφ. This surfaceis deformed by solving a partial differential equation on aregular sampling ofφ. The deformation of a level set sur-face is controlled by defining a speed functionF (x, ..) at apointx in the direction of the surface normal atx. We will

Page 10: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

introduce CSG operations for intersection, union and dif-ference, then blending, smoothening/sharpening and em-bossing on level sets.

Next we take a closer look on the speed function, whichis the basic concept we use to implement the surface edit-ing operators. Given the definition

F (~x, ~n, φ, ...) ≡ ~n∂~x

∂t(31)

we can rewrite the fundamental level set equation

∂φ

∂t+ ~v · ∇φ = 0 (32)

as

∂φ

∂t= |∇φ|F (~x, ~n, φ, ...). (33)

where ∂~x∂t is the velocity and~n ≡ − ∇φ

|∇φ| is the normalat ~x on the surface. The next problem is to determine thespeed function in a way, that we get the desired effect at thesurface of the model.The general structure for the speedfunctions used in the surface editing operations is

F (~x, ~n, φ) = Dq(d)C(γ)G(γ) (34)

whereDq(d) is a distance based cut-off function, thatdepends on a distanced to a geometric structureq. C(γ)is a cut-off function, that controls the contribution ofG(γ)to the speed function.G(γ) is a function that depends ongeometric measuresγ derived from the level set surface,e.g. curvature.Dq(d) acts as a region-of-influence (ROI)function. C(γ) is a filter of the geometric measure andG(γ) provides the geometric contribution of the level setsurface.

In order to regionally restrict the deformation duringlevel set computation, a technique is needed for drivingthe value ofF () to zero outside the region. The first stepis that the user has to define a region of influence. Thiscan be done by interactivly placing a 3D object around theregion or by automatically calculating this region basedon the surface properties. The second step consists of cal-culating a distance measure to the ROI primitive. The fi-nal step involves defining a function that smoothly reacheszero at the boundary of the ROI (see figure 5 a,b and c).

Another feature of the operators is that they allow theuser to control the geometric properties of the surface inthe region being edited. This feature is implemented withanother cut-off function,C(), within the level set speedfunction. C() allows the user to slow and then stop thelevel set deformation as a particular surface property ap-proaches a user-specified value (see Figure 5(d)). At anypoint on the surface we can only move in the direction ofthe normal, but we can direct the movement inward andoutward by redefining the speed functions at given points- for inward movementmin(G, 0) and for outward move-mentmax(G, 0).

Figure 5: (a) shows a common building function for theROI, the graphs in (b) and (c) are special variants of (a):(b) for the distance to a surface and (c) for the distance to apoint (d)is a cuttoff function for a geometric measure (e.g.curvature) [9]

8.2 The editing operators

First we will take a look at CSG operations, after that weproduce blending, smoothing/sharpening and a point setattraction/embossing operator.

8.2.1 CSG Operations

Since level set models are volumetric constructive solidgeometry operations of union, difference and intersectioncan be implemeted in the following way - here mentionedfor two level set models A and B, which are representedby distance volumesVA andVB .

CSG Operation Implementation

Intersection, A ∩B Min(VA, VB)Union, A ∪B Max(VA, VB)Difference, A−B Min(VA,−VB)

8.2.2 Localized Level Set Blending

The surface models produced by the CSG operations oftencontain sharp and sometimes jagged creases at the inter-section of two surfaces. We can improve these regions ofthe surface by applying an automatic localized blending.The method is localized because the blending operator isonly applied near the surface intersection region. One pos-sibility is to perform the deformation in regions near bothsurfaces. This approach results in blending the surfaces inall regions, where the surfaces come within a user speci-fied distance to each other. This creates unwanted blends.A better solution will be to perform the blend near theintersection curve of the surfaces. We can represent thecurve as point set and use the functionDp(d) in the region

Page 11: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

of influence function. Representing the intersection curveby a point set allows the curve to take an arbitrary form.

The blending operator moves the surface in a direction,that minimizes a curvature factorK on the level set sur-face. This is obtained by making the speed functionG()propotional toK leading to the following speed function:

Fblend(~x, ~n, φ) = αDp(d)C(K)K (35)

whereα is a user-specified positive scalar that controlsthe rate of convergence of the level set calculation.

8.2.3 Localized Level Set Smooth-ing/Sharpening

The smoothing operator smooths the level set surface in auser-specified region. This is managed by enclosing theregion of interest by a geometric object. The surface islocally smoothed by applying motions in a direction thatreduces the local curvature. This is accomplished by mov-ing the level set surface in the direction of the local normalwith a speed that is propotional to the curvature. This leadsto the following speed function:

Fsmooth(~x, ~n, φ) = αDs(d)C(K)K (36)

whereK is again a curvature measure,α a user speci-fied value (must be positive for smoothing and negative forsharpening). The other functions have the same meaningas before.

Figure 6: Regionally smoothing. Left: Laser scan recon-struction with unwanted, pointed artifacts in the eye. Mid-dle: Defining region of influence tzo be smoothed with asuperellipsoid. Right: Smoothing the surface within thesuperellipsoid. The surface is constrained to only moveinwards. [9]

8.2.4 Point Set Attraction and Embossing

By placing a point set near the surface, we are able to em-boss the surface with the shape of the point set. The useragain encloses the region to be embossed with a region ofinfluence primitive. The region of influence function forthis operator isDs(d).

First the attraction points are placed outside the levelset surface.~pi denotes the closest attraction point to~x ( apoint on the level set surface). The operator only allowsthe level set surface to move towards~pi if the unit vector~ui ≡ (~pi − ~x)/|~pi − ~x| is pointing in the same directionas the local surface normal~n. The speed function shouldonly be non-zero when0 < ~n · ~ui ≤ 1. Since the sign of

~n · ~ui is reverse if~pi is located inside the level set surfacewe simply requireγ = −sign[φ(~pi, t)]~n · ~ui to be positivefor any closest attraction point~pi. This amounts to hav-ing only positive cut-off values forC(γ). Finally we letG = −αφ(~pi, t) since this will guarantee that the level setsurface will stop once it reaches~pi. The following speedfunction models this operator:

Fpoint(~x, ~n, φ) = −αDs(d)C(−sign[φ(~pi, t)]~n·~ui)φ(~pi, t)(37)

Figure 7: Left: Three types of single point attrac-tions/repulsions using different region of influence prim-itives andγ values. Right: Utha teapot embossed with7862 points sampling the “SIGGRAPH 2002” logo. [9]

9 3D Shape Morphing

Three-dimensional morphing is based on smoothly chang-ing the source model into a target model. Shape morphinghas been developed for polygon based models and volu-metric models. The surface based algorithms transformthe patches of the source model into the patches of the tar-get model. The volume based morphing algorithms repre-sent 3D objects as volumes and manipulate the voxel val-ues in order to achieve a proper transformation.

Next we will look at the properties such an algorithmshould provide:

1. The transition process should start with the sourcemodel and end with a target model.

2. Intermediate models should undergo continuous 3Dtransitions

3. The morphing should apply to a wide range andtopologies.

9.1 A Level Set Approach for ShapeMorphing

First we define the source and target models as a levelset of a densly sampled three dimensional function. Thesampling produces a regularly-spaced rectilinear volumedataset.

Page 12: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

Next we must model a morphing step which is pro-duced by two steps: The first step is a global geometricwarping, which defines a coordinate transformation of thesource model into same shape and direction of the targetmodel. This is managed by a gradually improving pro-cess, where every point of the source model level set ismapped to some distance volume of the target level set.The second step is a blending, which ensures that any dif-ferences between the two models are gradually removedover the morphing process. This deformation step is con-trolled by the optimization of a function, that describes thesimilarity between the target and the source model. Atuser defined time intervals the model is transformed in apolygonal model (e.g. marching cubes algorithm), or canbe rendered by some other volume based algorithm. Thelevel set approach has some advantages to surface basedalgorithms: It does not rely on any parametrization, hasthe advantage, that we don’t need any reparametrizationof our models and we can change the topologies easier, sowe can “split” and “join” again our model during a mor-phing process.

9.2 The Metamorphosis Process

First we will discuss a general algorithm for the metamor-phosis process and in the next chapter we will add level setmethods to this algorithm.

At the beginning, we have to define a metric, whichquantifies the similarity between the target and the sourceobject. The two models are defined as subsets ofR

3 ΩA,the source model, andΩB , the target model. Each modelis enclosed by a surfaceSA = ∂ΩA andSB = ∂ΩB . Itshould be mentioned that each object could consist of mul-tiple disconnected parts, each with any number of holes.

We define an inside-outside function for the targetmodel:

γB : R → R, (38)

γB(x) = 0 ∀x ∈ SB ,

γB(x) > 0 ∀x ∈ ΩB ,

γB(x) < 0 otherwise

The inside-outside functionγB can be used to quantifythe extend to which the intermediate shapeΩt overlapswith the target,ΩB , with the volume integral

MΩB ,Ωt =∫

Ωt

γB(x)dx. (39)

This integral reaches maximum whenΩt = ΩB . Theincremental changes in the object shape can be expressedin terms of the surface that encloses it;

∫Ωt+dΩt

γB(x)dx =∫

Ωt

γB(x)dx+∫

St

γB(x)ε(x)·N(x)dx,

(40)

whereN : St → S3 is the surface normal, which is amapping from every point on the surface to the unit sphere.Differentiating with respect toε gives:

∂M = γB(x)N(x) (41)

from this equation we could extract the surface motionin the following manner:

∂s

∂t= γB(s(t))N(s(t)) ∀s(t) ∈ St. (42)

Each point on the surfaceSt moves at each time stepdtin the direction of the surface normalN(s(t)) with a stepsize propotional to the value of the inside-outside functionγB(s(t)).

9.2.1 Properties

The steady-state solution of the partial differential equa-tion (42) is the surfaceSt, such that∂s(t)/∂t = 0 for alls ∈ St. The steady state is denoted asS∞.

γB(x)N(s) = 0 → γB(s) = 0 ∀s ∈ S∞ (43)

The inside-outside function for the target,γB , has theproperty that

γB(x) = 0 ⇔ x ∈ SB (44)

From the equations (43), (44) and ifS∞ is aclosed sur-face, we can conclude thatS∞ = SB .

Figure 8: Contraction and expansion during the morph be-tween source,Ωt, and target model,ΩB . [4]

Another important fact is that a part of the source model,which overlaps with the target model will deform in sucha way that it will take the shape of target model. Thisfollows from:

MΩB ,Ωt = M iΩB ,Ωt

+MoΩB ,Ωt

=∫Ωi

t

γB(x) +∫

Ωot

γB(x), (45)

Page 13: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

whereΩit = Ωt ∩ ΩB andΩo

t = Ωt − Ωit − SB . The

exterior part contracts to the surface regionΩt ∩ SB . Theinterior model expands, but cannot pass into the exterior,becauseγB is negative on the outside of the target and pos-itive inside (see figure 8). So the surface keeps on movingat a rate

∂M i

∂t=

∫Si

t

γB(x)dx (46)

until it reaches the boundarySB .This leads to the following strategy for shape metamor-

phosis: construct a family of objectsΩt with Ωt|t=0 = ΩA

that maximizesM . If properly initialized (i.e., all of thecomponents ofΩB have some overlap withΩA) then thedeformation will seek the global maximum,ΩB . In thecase the user is not able or willing to match correspondingobjects, so that these objects overlap, we have to considera method to fill in gaps between the objects. In this casewe can use level set models to achieve a continuous coor-dinate transition.

Figure 9: A dart arrow morphing into a X-29 with interpo-lating surface colors. [4]

9.3 Adding the Level Set Model

According to the level set theory we can express a familyof surfaces in the following way:

St = x|φ(x, t) = k. (47)

Because s(t), a point of the surface, that moves throughspace, remains the kth level-surface ofφ over time, thetotal derivative ofφ with respect to time must be zero:

∂(s(t), t)∂t

+∇φ(s(t), t) · ds(t)dt

= 0, (48)

which establishes the connection between the way apoint onSt moves and the way the color values (at po-sitions on the surface) of the embedding change (see fig-ure 9). Using the fact∇φ = |∇φ|N we can rewrite theequation (48) in the following way:

∂φ

∂t= −∇φ · ds(t)

dt= |∇φ|ds(t)

dt·N(s). (49)

Now we can plug in our considerations of metamor-phosis from the previous chapter by using equation (42),which leads to the following equation:

∂φ(x)∂t

= |∇φ(x)|γB(x) (50)

Now we are finished, because we have a level set for-mulation of the methamorphosis algorithm. The partialdifferential equation of this algorithm (42) can be solvedby numerical methods like finite differences. We can alsofill gaps between parts of the target and source model dueto the level set approach by using appropriate isosurfaces(i.e. level sets).

10 Physics based Modeling

Although computer graphics has made great progresses,realistic modeling and rendering of dynamic natural phe-nomena is still a challenge. Giving the impression of wateror fire, for example, is impossible with traditional meth-ods of computer graphics. Level set methods in combina-tion with PDEs based on physical laws seem to offer goodsolutions for such problems - at least recent results showpromise.

The strategies found to be useful are often adapted frommethods of simulation for mechanical engineering. How-ever the aim of computer graphics is not to simulate a me-chanical system with high correctness. The trend rather isto simplify physical models in oder to gain computationalefficiency by, at the same, time keeping a high degree ofreality.

The second item that often has to be considered whenmethods of engineering are adapted for compuger graph-ics is that in engineering usually first the conditions of aphysical system are defined. The system is then more orless left alone and engineers simply watch its evolvementand interpret the results. In computer graphics the situa-tion is different. Here one rather wants to control the run-ning process and real physics plays not such an importantrole as long as the result is visually nice.

Page 14: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

We want to describe two important applications of phys-ical based simulations for computer graphics: water andfire simulation. Although these are rather different phe-nomena at first view, both follow similar well known phys-ical laws, the Navier-Stokes equations.

10.1 Water Simulation

Water appears everywhere in our everyday lives and henceeverybody has a good idea of how water behaves. So it isnot astonishing that great efforts have to be made to givesomebody the impression of real water with methods ofcomputer graphics. In the following we will describe analgorithm proposed in [8] and improved in [7]. This al-gorithm uses the Navier-Stokes equations in combinationwith level set and particle methods to model evolving wa-ter surfaces.

10.1.1 Representation of Physical Quantities

The two physical quantities that govern the motion of awater surface are velocity and pressure. These two quan-tities each form a field and hence are continously spreadover space. A special grid is used to save velocity and pres-sure. This grid does not has to have a very high resolutionsince we are not interested in total physical correctness.Every cell in the grid stores the pressure and the velocityat its position. In fact, the velocity is not stored for eachcell. Adjacent cells somehow rather share velocities. Ad-jacent cells share a common face and the component of thevelocity that is normal to this face is stored. These normalsare centered at the faces and represent the components ofvelocity aligned to the coordinate axes.

What we also have to consider and what is also storedin this grid is the amound of water that resides in each cell.This is important for realizing mass conservation.

10.1.2 Representation of the Water Surface

We described an environment for representation of thephysical quantities so far. The next step will be to finda good representation of the water surface itself. We willfirst discuss three possible models which lead to good re-sults in special cases but also have disadvantages in othercases. After that we combine these three models to a hy-brid model. The three pure models are:

1. Particles: A rather straight forward method to keeptrack of the water surface is to distribute particles inspace and keep track of them according to the under-lying grid described above. Particles are a straightforward method and work very well at first view. Theproblem however is that the distribution of particlescan not be controlled. It might happen that some re-gions are sparsely resolved because of the lack of par-ticles while other regions are filled with more parti-cles than neccessary. Even worse is the fact that ren-dering can not easily be done. To visualize the scene

with traditional methods, it would be neccessary toextract a mesh or a smooth implicit function of theparticles which is everything else than an easy task.

2. Volumetric Particles: To eleminate the problemswith rendering that arise from the use of simple par-ticles, an alternative approach can be realized. Theidea is to use volumetric particles that are representedby simple spheres around the positions of the parti-cles. This can be realized using an implicit functions.An implicit function around a particle with positionxp might be

φp(x) = d(x, xp)− r,

whered is the Euclidean distance betweenx andxp

and r denotes the radius of the volumetric particle.The surface is defined as the set of points for whichφp(x) = 0. An implicit function, φ(x), over thewhole space and over all particles, can now be devel-oped by taking the value ofφp(x) from the particlexp closest tox as the global level set value.

Samplingφ(x) at each point of a high resolutiongrid makes it possible to tessellate the isocontour forwhichφ(x) = 0. This can easily be done by applica-tion of the well known marching cubes algorithm, forexample.

3. Dynamic Level Set: The third approach of repre-senting the water surface uses level sets. The fluidsurfaces are defined by the points for which the levelset functionφ is zero-valued. Propagation of the sur-faces is computed using equation (1). The advantageof this method is that no particles have to be used andno care must be taken about their distribution over thevolume.

Although this approach is elegant, it has a great dis-advantage. In fact it can be shown that the pure levelset method leads to dissipation of volume where thewater splashes wildly. Parts of the water break awayfrom the surface and often simply disappear becausethey are too small to be resolved by the level set.

We note that the first two approaches are appropriate forwater splashing around wildly. The third approach how-ever is useful when the water surface is quiet and smooth.

Thehybrid surface model tries to combine the differ-ent approaches. Indeed the hybrid model uses level setsas well as particles. This makes sense since the level setsare used for areas where the water behaves smooth. Whensplashing occurs particles are added to prevent the waterfrom dissipation.

At first only the level set function is considered. Basedon its values the curvatureκ can be computed near thesurface. Whenκ has a high value this indicates that thesurface is not smooth at the observed region and splashingis likely to happen. Because the concept of particles leadsto much better results in these regions they are inserted

Page 15: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

there. These particles then may locally modify the valueof φ.

It might also happen that particles sometimes com-pletely escape from the water surface. In such cases theymight be rendered as independent small volumetric ob-jects. This gives the impression of small water drops ormist separating from turbulent water.

What also might happen is that particles move deep intothe water. If this is the case they have no effect on thewater surface and can be discarded.

10.1.3 Interaction with Solids

Introducing boundary conditions is very important forcontrolled animation and interaction of fluids with othersolid objects. To control the motion of fluids without inter-action with objects can simply be done by predefining val-ues for velocities. This is not an absolutely perfect strategybecause effects of assigned values can often only be foundout after running a simulation. However this is an inherentproblem since perfect control about a process would re-quire to ignore physical realities which again would resultin unrealistic behavior.

Moving objects lead to a slightly more complicated situ-ation. When a moving solid object is simulated to interactwith a fluid like water, care must be taken that

• no liquid flows into the object,

• the liquid flows freely tangential to the surface of theobject and

• neither the particles nor the level set surface passesany part of the surface of the solid object.

Update of velocity is neccessary to meat these postula-tions. A number of cases have to be considered like that ofcells inside the solid objects. Velocities of such cells mustbe set to that of the moving object. A list of relativelyintuitive treatment of some cases is given in [8].

10.1.4 Updating the Scene

The first step in updating the scene is to compute a timestep∆t. This can be done by considering the so calledCourant-Friedrichs-Levy condition. This condition saysthat ∆t must be less than the minimum time over which“something significant” can occur in the simulated system.

When∆t is determined the following steps have to bemade in order to discretely update the environment:

1. Compute the values that come from the convectionterm(v · ∇)v and the viscousity termν∇2v of equa-tion (11) and update the current~u with these values.

2. Include boundary conditions into the fields of veloc-ity and pressure. These boundary conditions mightrepresent static objects like walls of borders of a glasswhere the water is poured into. More interesting how-ever are moving objects that interact with the water in

a more complicated way. Issues concerning that willbe discussed below.

3. The values derived from the first two steps do notconsider conservation of mass (expressed by equation(10)) and the term treating pressure in equation (11).This has to be done now based on the results of steps1 and 2.

4. Finally the values of the level set function and thevolumetric particles are updated using the values ofthe velocity fieldv.

10.2 Fire Simulation

There have been several attempts to simulate fire. We wantto give an overview over the work of Nguyen, Fedkiw andJensen and the approach they proposed in [10]. They sug-gested to split up the regions of a flame into three parts.Each part can then be treated separately. A blue core rep-resents the fuel floating into the flame. Around this bluecore the fuel reacts and turns into gaseous products. Thisis the part of the flame usually having yellow or orangecolor. Around this domain the gas cools down and blacksmoke evolves.

Euler equations rule the interfaces of the core and thegaseous products around it. This implicates that viscosityis disregarded which corresponds to the behavior of fire.Smoke is usually simulated using small particles. How-ever in this chapter we will ignore smoke and concentrateon the fire consisting of the blue core and the orange oryellow gaseous products around it. To avoid unnatural re-duction or augmentation of the flame, we assume that thecore as well as the gaseous products are incompressible.

10.2.1 The Flame in Detail

The blue core represents the fuel floating into a flame. Itsborder is modeled using an implicit function. Its surface,As, can be estimated with the following equation

vfAf = SAs (51)

wherevf is the speed of the fuel floating into the flame.Af

is the area through which the fuel floats into the core.Sis the speed with which the fuel burns. This is exactly thevelocity with which the fuel turns into gaseous productsand leaves the core. Equation (51) results from cancelingout the density in the equation for conservation of mass.Sis constant for a specific fuel. For exampleS is approxi-mately44m/s for a propane fuel premixed with oxidizer.The size of the blue core can be controlled by changingthe speedvf . Increasing (decreasing)vf results in a larger(smaller) blue core.

When the fuel burns it reacts with oxygen and expands.This expansion has a definitive effect on the trajectories ofparticles and hence is important to be modeled. Increasingthe effect of expansion results in a flame that appears to be

Page 16: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

Figure 10: Flames with different degree of expansion.The amount of expansion increases from left to right.Reprinted from [10]

fuller. Figure 10 shows three flames with different param-eters for expansion. Note that expansion is the reason whyvelocity and pressure are not continuous across the borderbetween core and hot gases. This must be considered whencomputing a derivative which is neccessary for solving theNavier-Stokes equations. A special method, known as theghost fluid method, can be used to handle the discontinu-ities of pressure and velocity. With this method one cancompute so called ghost values for speed of the fuel out-side the core.

Buoyancy also has to beconsidered. It turns up the flameand is modeled as separate force in the Navier-Stokesequation governing conservation of momentum. Buoy-ancy is often considered as being directly proportional totemperature.

10.2.2 Implementation

Again we use a grid, similar to the one used for simula-tion of water, for storing important physical properties.Again the velocities are saved at the centers of faces fortwo adjacent cells. The scalars needed for fire simulationare temperature, pressure and density. Implicit functionsrepresenting surfaces might also be stored in the grid orcan be represented by an extra grid with higher resolution.

The governing Euler equations are solved for the coreand hot gases separately. The Euler equation modelingconservation of momentum is

∂~u

∂t= −~u · ∇~u− 1

ρ∇p+ f, (52)

wheref is an external force including buoyancy. The firststep to update the velocity field~u is to compute an interme-diate velocity~u∗ ignoring the term with pressurep. Thena correction term that does include pressure is subtractedto ge the final update of~u:

~u = ~u∗ −∆t1ρ∇p (53)

By taking the divergence of equation (53) we obtain

∇ · ~u = ∇ · ~u∗ −∆t∇ · (1ρ∇p) (54)

Considering∇ · ~u = 0, equation (54) can be transformedto

∇ · (1ρ∇p) = ∇ · ~u∗/∆t (55)

which allows us to compute the pressure. This value forthe pressure can then again be used for updating the veloc-ity.

11 Conclusions

Level set methods alone are a well known concept in com-puter graphics. PDEs are recently added to pure level setmethods in order to be able to model dynamic behavior.The combination of these two powerful methods is appli-cable for a lot of problems in computer graphics. The ap-plications we presented in this paper are very young and itis likely that even more applications for PDE and level setmethods will come up soon.

One problematic thing concerning PDE and level setmethods is that they are usually very time consuming.Real time computation of PDE and level sets can not beachieved with standard hardware.

References

[1] L. Ambrosio and H. M. Soner. Level set approach tomean curvature flow in arbitrary codimension.Jour-nal of Differential Geometry, 43:693–737, 1996.

[2] M. Bertalmio, A. Bertozzi, and G. Sapiro. Navier-stokes, fluid dynamics, and image and video inpaint-ing. Proc. Conference on Computer Vision and Pat-tern Recognition, pages 730–764, 2001.

[3] J. Blinn. A generalization of algebraic surface draw-ing. ACM Transactions on Graphics, 1(3):235–256,July 1982.

[4] D. E. Breen and R. T. Whitaker. A level-set ap-proach for metamorphosis of solid models.IEEETransactions on Visualization and Computer Graph-ics, 7(2):173–192, 2001.

[5] P. Burchard, Li-Tien Cheng, B. Merriman, and S. Os-her. Motion on curves in three spatial dimensions us-ing a level set approach.Journal of ComputationalPhysics, 170(2):720–741, 2001.

[6] J. C. Can, R. K. Beatson, J. B. Cherrie, T. J. Mitchell,W. R. Fright, and B. C. McCallum. Reconstructionand representation of 3D objects with radial basisfunctions. InSIGGRAPH 2001, Computer GraphicsProceedings, Annual Conference Series, pages 67–76, 2001.

Page 17: Level Set and PDE Methods for Computer Graphics · The order of a linear PDE is the number of the high-est derivation existing in the PDE. In the group of second order partial differential

[7] D. Enright, S. Marschner, and R. Fedkiw. Ani-mation and rendering of complex water surfaces.ACM Transactions on Graphics, 21(3):736–744,July 2002.

[8] N. Foster and R. Fedkiw. Practical animation of liq-uids. InSIGGRAPH 2001, Computer Graphics Pro-ceedings, Annual Conference Series, pages 23–30.ACM Press / ACM SIGGRAPH, 2001.

[9] K. Museth, D. E. Breen, R. T. Whitaker, and A. H.Barr. Level set surface editing operators.ACMTransactions on Graphics (SIGGRAPH ’02 Proceed-ings), 21(3):330–338, July 2002.

[10] D. Q. Nguyen, R. Fedkiw, and H. W. Jensen. Phys-ically based modeling and animation of fire. InSIGGRAPH 2002, Conference Proceedings, AnnualConference Series, pages 711–718. ACM Press /ACM SIGGRAPH, 2002.

[11] S. Osher and R. Fedkiw. Level set methods: Anoverview and some recent results.SIGGRAPH 2002,Course 10 Notes, pages 96–160, 2000.

[12] S. Osher and J. A. Sethian. Fronts propagating withcurvature dependent speed: Algorithms based onHamilton-Jacobi formulations.Journal of Compu-tational Physics, 79:12–49, 1988.

[13] A. Turing. The chemical basis of morphogenesis.Philosophical Transactions of the Royal Society, Se-ries B: Biological Sciences(237):37–72, 1952.

[14] G. Turk. Generating textures on arbitrary surfaces us-ing Reaction-Diffusion.SIGGRAPH ’91, ComputerGraphics Proceedings, 25(4):289–298, 1991.

[15] G. Turk and J. F. O’Brien. Modelling with im-plicit surfaces that interpolate.ACM Transactions onGraphics, 21(4):855–873, 2002.

[16] A. Witkin and M. Kass. Reaction-Diffusion textures.Computer Graphics, 25(4):299–308, July 1991.

[17] Hong-Kai Zhao, S. Osher, and R. Fedkiw. Fast sur-face reconstruction using the level set method.Pro-ceedings of IEEE Workshop on Variational and LevelSet Methods in Computer Vision (VLSM 2001), July2001, pages 194–202, 2001.


Recommended