Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Noname manuscript No.(will be inserted by the editor)
Automated Sampling and Control of Gaseous Simulations
Ruoguan Huang · John Keyser
Received: date / Accepted: date
Abstract In this work, we describe a method that au-
tomates the sampling and control of gaseous fluid sim-
ulations. Several recent approaches have provided tech-
niques for artists to generate high resolution simula-
tions based on a low resolution simulation. However, of-
ten in applications the overall flow in the low resolution
simulation that an animator observes and intends to
preserve is composed of even lower frequencies than the
low resolution itself. In such cases, attempting to match
the low resolution simulation precisely is unnecessar-
ily restrictive. We propose a new sampling technique
to efficiently capture the overall flow of a fluid simula-
tion, at the scale of user’s choice, in such a way that
the sampled information is sufficient to represent what
is virtually perceived and no more. Thus, by applying
control based on the sampled data, we ensure that inthe resulting high resolution simulation, the overall flow
is matched to the low resolution simulation and the fine
details on the high resolution are preserved. The sam-
ples we obtain have both spatial and temporal continu-
ity that allows smooth keyframe matching and direct
manipulation of visible elements such as smoke density
through temporal blending of samples. We demonstrate
that a user can easily configure a simulation with our
system to achieve desired results.
Keywords Eulerian simulation · Simulation control ·Poisson disk sampling · Bilateral sampling
Ruoguan HuangTexas A&M UniversityE-mail: [email protected]
John KeyserTexas A&M UniversityE-mail: [email protected]
1 Introduction
Fluid simulation has been an area of great interest within
the computer graphics community. As quality and ef-
ficiency have improved, fluid-based visual effects have
been widely applied in industry. This has led to a stronger
desire to have control over the simulation, while still
preserving a behavior that seems realistic.
Despite improvements in simulation techniques, large
fluid simulations are still notoriously slow to compute.
This makes the prospect of controlling and directing
such simulations problematic. Users can specify initial
conditions and other parameters, but it can take hours
to see the overall effect those conditions produce.
To improve the rate of feedback and thus conver-
gence to an acceptable result, artists often first run a
lower-resolution simulation (which will be much faster)
to adjust parameters and settings. Once an acceptable
simulation has been found, a higher resolution simula-
tion is produced. Simply using the same parameters as
the lower resolution can cause problems, since the small
differences in the simulation (e.g. from artificial viscos-
ity or object boundary effects) can quickly lead to much
larger and visually significant differences. Adding artifi-
cial noise and vortices provides detail, but not the real-
ism of a higher-resolution simulation. Keyframe match-
ing can provide good results, but it can be problematic
to determine good keyframes and ensure that the sim-
ulation is not overspecified, removing desired detail.
In this paper we present improvements for automat-
ically matching a high resolution gaseous fluid simula-
tion to a lower resolution simulation. Specifically, we
show that our automated system requires minimal user
editing and tweaking and a relatively low additional
computational overhead to provide necessary control
for achieving desired visual effects. Our approach fol-
2 Ruoguan Huang, John Keyser
lows the general framework of Huang et al. [9], where
control is achieved by sampling data from a low reso-
lution preview simulation at a set of “match points” in
a user-selected region and then matching a high reso-
lution to the match points. In many cases, the method
of Huang et al. requires that the user provide rather
specific placement (spatial and temporal) and detailed
properties of match points to produce desired results.
Even with the help of user direction, the statically po-
sitioned match points are usually inefficient and some-
times inaccurate in how well they capture the constantly
flowing motion of fluids.
To better and more efficiently capture interesting
fluid features, we propose a new method for dynam-
ically sampling arbitrary types of data from a simu-
lation with the goal of achieving spatially and tem-
porally more continuous sampling. With this dynamic
sampling, we can easily incorporate temporal blend-
ing in the matching stage to achieve much smoother
and hence more plausible control effects. This is key
to manipulating directly visible fluid components (e.g.
gaseous density), supporting discontinuous control (e.g.
keyframe matching), and allowing artistic direction.
Among the key features of our method are:
– Automated sampling detects and captures the promi-
nent features of fluids and follows the flow, resulting
in smoother more accurate control without tedious
manual editing.
– Temporal sampling and blending allow seamless key-
frame matching and plausible density manipulation,
and handle various other sudden and drastic changes
in control.
– Our density control preserves edges presented in the
density field by using bilateral density sampling that
reduces the blurring of high frequency details in the
high resolution.
2 Previous Work
Our method is based on a Eulerian fluid simulation
framework. Interest in fluid dynamics simulations in
computer graphics increased significantly with the work
of Foster and Metaxas [5,6] and the subsequent Sta-
ble Fluids approach introduced by Stam [27]. Stam’s
method used an implicit solver, making the simula-
tion unconditionally stable, and thus allowing coarse
grid resolutions and large time steps. There has been
a tremendous amount of follow-on work which has pre-
sented improvements in various aspects of the simu-
lation, and a thorough discussion of this work is be-
yond the scope of this paper. While particle-based (La-
grangian) simulations have also become popular [16],
Fig. 1 Example of our controlled simulation with temporalblending. On each row from left to right are low resolutionpreview, controlled simulation, uncontrolled high resolutionsimulation. The top row shows images taken at the time westart to apply control. Before that simulation in the middleis uncontrolled, hence it looks exactly the same as the highresolution simulation at right. The bottom row shows imagestaken approximately 150 frames later when the applied con-trol is fully in effect. The middle now resembles the previewat left.
Eulerian simulations continue to be widely used, par-
ticularly for gaseous and incompressible situations.
Controlling fluid simulation was first investigated
by Foster and Metaxas [6] and later by Foster and Fed-
kiw [4], and has been addressed by a number of other
researchers. Rasmussen et al. [22] proposed a produc-
tion model using particles to control liquid simulations.
Shi and Yu have proposed methods for matching smoke
[25] and liquids [26] to changing target shapes. Pighin
et al. [21] have combined Eulerian and Lagrangian rep-
resentations to create a system for interactively manip-
ulating fluid flows. Their method parameterizes a fluid
simulation from advected particle paths, allowing fine-
grained control of the system by manipulating these
paths. Hong and Kim [8] use a geometric potential field
to generate forces to match target shapes. Schpok et
al. [24] control the simulation by manipulation of auto-
matically extracted simulation features. Angelidis et al.
[1] and Kim et al. [12] provide path control for smoke
simulations.
Automated Sampling and Control of Gaseous Simulations 3
A few recent methods approach the problem de-
scribed from a different perspective, namely that high
frequency “detail” is added into a coarse simulation,
thus giving the appearance of a higher-resolution sim-
ulation. Kim et al. [11] use a wavelet-based method to
generate fine turbulent details within a fluid simula-
tion. Schechter and Bridson [23] similarly upsample a
lower resolution simulation and add turbulent detail.
Narain et al. [17] also use a procedural method to add
in turbulence, but in addition they identify locations for
additional turbulence based on the energy computation
in the fluid simulation. Pfaff et al. [20] add the procedu-
ral turbulence by generating and advecting turbulence
particles based on the simulation. Finally, He et al. [7]
improve the Second Vorticity Confinement method [28]
to produce detailed turbulence effect on a coarse grid.
Closer to our approach, several algorithms have fo-
cused on the keyframe concept. Treuille et al. [31] pro-
posed a fluid control system based on user-defined smoke
density keyframes. The fluid system is controlled by
parametric wind and vortex fields that are manipulated
to make the simulation achieve the specified keyframes.
The amount of adjustment to the vector field is mini-
mized via a non-linear optimization. This optimization
is expensive, and dimensionality grows with the length
of the simulation. The approach was practical only for
2D simulation, but McNamara et al. [15] improved on it
by using a discrete adjoint method for gradient calcula-
tion. They achieve much faster convergence for control
parameters, thus enabling fine-grain keyframe control
on larger 3D fluid animations.
Instead of optimization, Fattal and Lischinksi [2] in-
troduce new terms into the standard flow equations, of-fering a closed form solution for the control parameters.
Matching target densities using only advection is usu-
ally not enough, and so they propose smoke gathering,
diffusing the error field. This allows complex smoke an-
imations to be controlled with little additional expense.
Later, Thurey et al. [29] in their particle based method,
also apply correcting forces through Lagragian particles
extracted from coarser simulations to control the low
frequencies of higher resolution simulations. Sharing the
same motivation, Nielsen et al. [18,19] create a direct
coupling between a low resolution preview simulation
and a higher resolution final simulation. The high reso-
lution simulation is created by incorporating an upsam-
pled velocity field from the low-resolution simulation as
additional constraints into pressure projection. In their
earlier paper, Nielsen et al. [18] introduce the method,
and present the multigrid framework used to solve it.
In their later paper, Nielsen and Christensen [19] ex-
tend the earlier work to support more efficient time-
varying computation, and use density to help determine
the level of control to provide. Though density is used
to help determine control, the actual adjustments are
made only to the vector field. Yuan et al. [32] also pro-
vide a guiding simulation that does not directly correct
density. Their method extracts flow patterns from a low
resolution simulation and uses a pattern-based guiding
force to force the higher resolution simulation to match.
Huang et al. [9] control a high resolution simulation
based on data sampled at user selected regions in a low
resolution simulation. The “match points” that they use
to cover and sample select regions, have finite support
and fairly scarce distribution which allow quick local
adjustment and leave room for high frequency features
to develop. In terms of sampling a simulation, match
points resemble control particles that are discussed by
Thurey et al. in [29]. Control particles can be generated
from a Lagrangian simulation and hence themselves al-
ready carry the nature of fluids, yet they rely on fully
simulated particle-based fluid dynamics. Match points
work in a more general way and are better for matching
scalar values such as density, yet they are nontrivial to
configure and their static positions are sometimes in-
sufficient for tracking fluid motions.
3 Review of Preview Based Control
We begin with an initial (low resolution) simulation
called the preview. Our goal is to produce a high res-
olution final simulation that is adjusted to match the
behavior of the preview at specified regions and times.
Our method follows the approach outlined in Huang et
al. [9] and we give an overview of that method here as
background.
In broad terms, we will run a low-resolution fluid
simulation, sample the vector and scalar data from that
simulation, and then run a high-resolution simulation
in which we match the sample data collected at lower
resolution.
3.1 Sampling the Flow Equations
The inviscid equations for incompressible flow u are
∇ · u = 0 (1)
∂u
∂t= f − (u · ∇)u−∇p (2)
and density d advected by the flow is defined as
∂d
∂t= S − (u · ∇)d+ kd∇2d (3)
As mentioned earlier, instead of precisely matching
all details of the low resolution simulation, we want to
be able to control the scale and locations at which the
4 Ruoguan Huang, John Keyser
final will match to the preview. Thus, we sample the
properties of the preview at specified locations, scales,
and times, and use these samples for matching, later.
We call these samples match points. Each match point
is defined by a position xi, a scale ri, and a matching
function mri . We will refer to a match point by its po-
sition xi. To sample the simulation in scale space, we
convolve the simulation data with a Gaussian kernel of
the given scale. We sample scalar d and vector data D
separately as follows:
dri =1∑Gr
∑x
Gr(xi,x)d(x) (4)
Dri,1 =
1∑Gr
∑x
Gr(xi,x)D(x) (5)
Dri,2 =
1∑Gr
∑x
Gr(xi,x)D(x)× (x− xi) (6)
G is the Gaussian weight function with radius r:
Gr(xi,x) = e−r|xi−x|2 (7)
Note that we obtain two pieces of information from
D, direction D1 and angular momentum around xi with
unit mass D2, to measure both linear and angular mo-
tion in the vector field.
In the matching process, we sample the final (un-
matched) simulation at the same points specified in
the keyframe. The difference between the final and the
keyframe will be used to modify (match) the final.
3.2 Controlling the Simulation
Matching is done in two passes at each timestep. In
the first pass, a step of the simulation is taken at high
resolution, and that simulation is sampled at the xiand scale(s) r. For scalar data we obtain the (weighted)
current value dri and for vector data determine Dri,1 and
Dri,2. The computations are performed in the same way
as for the samples from the preview (see equations 4, 5,
and 6).
The weighted errors:
δri = mri (dri − d
r
i ) (8)
∆ri,1 = mr
i (Dri,1 −Dr
i,1) (9)
∆ri,2 = mr
i (Dri,2 −Dr
i,2) (10)
will represents the amount of “control” that needs to be
applied to the high resolution simulation at the match
point.
The idea of matching is that we want to modify
the high resolution simulation by the control amounts.
Notice that in Equation 2 f accounts for external forces
and in Equation 3 S defines a density source (or sink).
The controls will have the same effect as introducing
additional f and S to the system. The matching will
be created by spreading the control amount over the
region around the match points with a spatial blending
function G′.
G′r(xi,x) =Gr(xi,x)∑x(Gr(xi,x))2
(11)
Thus, for a point x in space, we increase the density
value at x by δriG′r(xi,x). A similar process is used
to spread directional velocity control ∆ri,1, but simple
vector addition is used in the sum. Applying control on
the curl is slightly more complicated. For a point, p, the
change in the vector value due to curl control is:
G′r(xi, p)(∆ri,1 × (xi − p)) (12)
4 Improving Sampling
The spatial and temporal placement and the weight mir
of match points dictate the result of control as both the
sampling and matching processes rely heavily on these
match points. However, the temporally and spatially in-
variant match points described by Huang et al. [9] raise
several issues. The match points need to cover the spec-
ified regions and be aligned with prominent features.
Automatic regular placement of sample points tends to
provide poor overall placement, and generally requires
oversampling to cover all areas of interest. While it is
possible for a user to manually specify a configuration
of samples, it is often tedious to place every match point
by hand and provide sufficient coverage as well as accu-
rate alignment. The sample points are set up with static
positions that are inefficient and inaccurate for captur-
ing the constantly flowing motion of fluids. The user
can set up one group of match points for each period
of time or simply cover the whole domain with match
points, yet neither is ideal in term of efficiency. If the
user intends to hit certain keyframes instead of match-
ing a whole sequence, the weight mir for each individual
match point needs to be set to vary over time to avoid
abrupt changes in the result.
To address these issues, we propose four improve-
ments to the sampling methodology. We describe be-
low methods for automatically determining features to
focus samples on, for generating good distributions of
sample points, for allowing sample points to move over
time, and for using a different filter for the samples.
4.1 Detecting Prominent Features in Simulations
The most prominent visual component in a gaseous
fluid simulation tends to be density. Density is often
Automated Sampling and Control of Gaseous Simulations 5
rendered (e.g. as smoke) and in most simulations in-
tended for realism it affects the velocity field through
forces like gravity. Within vector data (usually the fluid
velocity field) vortices not only are a fundamental el-
ement of fluids, but also provide strong visual detail.
Thus, we look at density and vortices to determine
whether a location is suited for placing a match point.
We assume that the user has browsed through a low
resolution preview simulation and specified a general
region R for matching. In implementations, we allow
a user to define R, e.g. as the projected volume from
a selected region in screen space, but the user can also
simply set the whole domain to be of interest and let our
system detect all the features for a complete match. We
consider a position x ∈ R to be a candidate position to
place a match point if any of following three inequality
conditions is satisfied.
d(x) > dmin (13)
|d(x)− d(x)| > ∆dmin (14)
|∇ × u(x)| > ωmin (15)
where dmin, ∆dmin, ωmin are pre-defined minimum val-
ues close to 0. That is, we identify points with high
density, large difference in density from the final, or
high vorticity as candidates for placing samples.
Given a candidate position x, we next determine
the radius r of the match point based on the gradient
of density and vorticity. This ensures that the sample
will be taken at a scale that matches the scale of a
feature.
r = max
{min
{dmax
∇d(x),
ωmax
∇|∇ × u(x)|, rmax
}, rmin
}(16)
where dmax and ωmax are pre-defined maximum values
to cap the change, within the support of the match
point, in density and vorticity, respectively. We clip the
radius r using user defined maximum radius, rmax, as
the ceiling and the size of the Eulerian grid cell of the
low resolution simulation, rmin, as the floor.
4.2 Modified Poisson Disk Distribution
Given the above criterion for determining good posi-
tions to place match points and what their radii should
be, we employ a modified dart-throwing Poisson disk
distribution algorithm [14,13] to fill the user specified
regionR with match points. The traditional dart throw-
ing algorithm generates uniformly distributed points,
and rejects points that do not satisfy the minimum sep-
aration with already generated points [13]. This process
continues until no more points can be added. In our
case, complete separation of match points is unneces-
sary and we instead allow some overlapping (a discus-
sion of how much overlapping is allowed between sam-
ples is given by Huang et al. [9]). Thus, we enforce a
smaller minimum distance between match points than
their actual radii combined. More specifically, we accept
a newly generated match point at position x, that sat-
isfies Equations 13, 14, or 15, with radius r determined
by Equation 16 if
|x− xi| < αmin(r + ri) αmin ∈ [0, 1] (17)
and the overlap is not so great as to prevent convergence
(see [9]). In our experiments, we find that αmin = 0.6
performs well in most cases.
The resulting distribution is not uniform as pro-
duced by a traditional dart throwing algorithm. In-
stead, the match points with differing radii are densely
distributed to cover regions with prominent features,
and yet moderately separated to guarantee convergence.
4.3 Advecting Sample Points
As mentioned before, statically positioned match points
do not follow the flow of a fluid simulation. We there-
fore advect the match points generated from the dart
throwing algorithm through the velocity field of the low
resolution preview simulation. We do not need to ad-
vect these particles by running a costly complete La-
grangian particle simulation. Instead, we simply use
first order Eulerian integration to update the position
of each match point with the velocity field u. More im-
portantly, match points that follow Lagrangian particle
physics are not necessarily aligned with prominent fea-
tures because they have a much more scarce distribu-
tion and larger radii.
After advection, the match points do not necessar-
ily meet the requirements of the modified Poisson disk
distribution or the properties of featured positions and
gradient based radii. We wish to avoid resampling the
region R because our goal is to maintain as much spa-
tial and temporal continuity as we can of the match
points, imitating a Lagrangian particle system. Thus,
we perform the following steps to fix the distribution
and properties of match points.
1. Recalculate the radius ri for each match point using
Equation 16.
2. Obtain samples from the preview simulation and
sort the match points (typically by the sampled den-
sity value dri , though other prioritizations can be
used).
3. Assign an integer value ai to every match point to
track its age. ai is increased by one each time step.
6 Ruoguan Huang, John Keyser
4. Remove any match point xi if ai > am and it does
not satisfy any of Equations 13, 14, or 15.
5. Remove any match point that violates the minimum
distance constraint described by Equation 17 or the
convergence limits [9], starting from the match point
with the lowest density sample.
6. Remove any match point that violates boundary
conditions, i.e. crossed a boundary.
7. Apply several more iterations of the modified dart-
throwing algorithm to fill the gaps in R.
Age tracking is intended to avoid repeated activa-
tion and deactivation of control in an area with density
that borders on the pre-defined threshold. We wish to
keep a match point that is under a mature age am, even
if it fails the density and vorticity tests. We will also use
age to modify the control weight mri to buffer sudden
activation of control (see Section 5.2). These steps will
bring back the desired distribution while preserving the
continuity needed for smooth control.
4.4 Bilateral Density Sampling
We sample the data from the low resolution preview
simulation through these match points that are pur-
posely placed to capture key features of fluids. Follow-
ing Huang et al. [9], we had used a Gaussian weighted
function for sampling, although any other function with
similar isotropic fall off should work as well. However,
when sampling gaseous densities, we encounter an issue
analogous to filtering in the area of computer vision—
the assumption of slow spatial variations fails at edges,
which are consequently blurred by low-pass filtering
[30]. When a match point is placed across a density edge
in the preview simulation, the adjustment made in the
high resolution is spread out within the support of the
match point in a Gaussian weighted fashion regardless
of the edge. Normally, we rely on the similarities be-
tween the preview and the high resolution simulation.
But in cases where drastic differences are presented in
the high resolution simulation, the edge from the pre-
view is completely lost.
Inspired by bilateral filtering [30] in computer vi-
sion, we use a bilateral Gaussian weighted function to
improve edge preservation for density matching. We ob-
tain two density samples through a match point at po-
sition xi with radius r, one for each side of the edge, as
follows:
dri,1 =1∑Gr
∑x
Gr(xi,x)H(xi,x)d(x) (18)
dri,2 =1∑Gr
∑x
Gr(xi,x)(1−H(xi,x))d(x) (19)
H is a radially symmetric closeness function with geo-
metric spread σh:
H(xi,x) = e− |d(xi)−d(x)|2
σ2h (20)
Note that the sum of Equation 18 and 19 is a standard
Gaussian function. We use these bilateral samples for
density matching in high resolution in Section 5.3.
5 Impoved Matching
The matching process modifies the high resolution sim-
ulation so that it agrees with the preview at the match
points. In prior work [9], matching followed a fixed pro-
cess that effectively forced a simulation to match the
preview at precisely the given frame. This could cause
significant problems if a match point was introduced
later in a simulation, in that the simulation would vis-
ibly “jump” to meet the sample. As a result, generally
the entire region of interest would need to be matched
through an entire simulation in order for the simulation
to match at the desired timestep.
We propose two improvements, temporal blending
and age weighting, that help support matching with-
out visible jumps in the simulation. Furthermore, we
describe matching with bilateral match points, giving
higher quality results.
5.1 Temporal Blending of Samples
When keyframes are specified several frames apart, con-
trol may introduce a sudden density/force into the sys-
tem. This could be extremely unrealistic and jarring,
and therefore we wish to apply control over a period
of time, effectively providing a temporal blend to the
control. If we wish to apply control at some point prior
to the keyframe time, we need to account for the ex-
pected change within the velocity field itself. We can
approximate the effect by advecting our match points
themselves backward through the velocity field. This
process effectively repositions all of the match points
at some earlier point in time, and the control process
is applied at those repositioned points. Note that this
accounts for only advection (when other forces will also
be active), and perhaps more importantly the conver-
gence guarantees would no longer apply. For these rea-
sons, the control applied at earlier timesteps should be
limited, for example by reducing the weight mri at ear-
lier timesteps and not iterating the control process to
convergence.
Our method circumvents these difficulties with an
advected Poisson disk distribution. Match points are
Automated Sampling and Control of Gaseous Simulations 7
advected through the velocity field and their positions
are continuous in space and time. These attributes elim-
inate the need for advecting the points backward. Con-
vergence is automatically guaranteed due to the well
maintained distribution. To match a keyframe at time
t1, we start to apply control at time t0 < t1. For a
frame at time t ∈ [t0, t1], we apply control through
match points with the weight mri = M(t), where M is a
blending function that increases monotonically from 0
to 1 as t approaches the keyframe time t1, e.g. a linear
version M(t) = t−t0t1−t0 .
5.2 Age-weighted Density Control
Compared to velocity, density is directly visible and the
control needs to be more subtle. For density control,
temporal blending of samples applies even for matching
a whole simulation sequence. To smoothly match the
sampled density from the preview simulation, we vary
the control weight of a match point based on its age
(introduced in Section 4.3). When the dart throwing
algorithm generates new match points xi, we do not
want it to apply maximum density control immediately.
Instead, we increase the match points’ weights over time
to the maximum value. Thus, we determine the weight
mri of match point xi with age ai as follows:
mri =
{ai/am if ai < am
1 otherwise(21)
Similar to the example we give for keyframe match-
ing, this is a linear blending function although it can
be replaced by other types of monotonically increasing
functions for different effects. We combine age weight
and temporal weight in a multiplicative fashion for tem-
porally varying density control.
5.3 Bilateral Spread of Density Control
In this section, we derive the spatial blending func-
tion to apply density control using the bilateral samples
mentioned in Section 4.4. Assume we have differences
Q1 = δri,1 and Q2 = δri,2 between the bilateral samples
of the preview and the final at match point xi. In order
to make the final match the preview, the sampled final
values must therefore increase by Q1 and Q2, respec-
tively. That is, we need to have
Q1 =∑x
Gr(xi,x)H(xi,x)Q′x (22)
Q2 =∑x
Gr(xi,x)(1−H(xi,x))Q′x (23)
where Q′x is the increase in density at point x. We wish
to find the amount to apply via a bilateral Gaussian
spread to result in the correct overall change. However,
because there are two constraints to meet, we instead
formulate the problem with two unknowns, Q′′1 and Q′′2 .
Q′x = Q′′1G1(x) +Q′′2G2(x) (24)
where G1(x) = Gr(xi,x)H(xi,x) and
G2(x) = Gr(xi,x)(1−H(xi,x)) for the sake of conve-
nience and simplicity. The idea behind Equation 24 is
that we wish spread two separated amounts, Q′′1 and
Q′′2 , such that a point x gets more contribution from
the amount that represents the same side of the edge
it resides on. Substituting into Equation 22 and 23, we
have:
Q1 = AQ′′1 +BQ′′2 (25)
Q2 = BQ′′1 + CQ′′2 (26)
where A =∑
x(G1(x))2, B =∑
xG1(x)G2(x) and C =∑x(G2(x))2. Solving for Q′′1 and Q′′2 , we get:
Q′′1 =BQ2 − CQ1
B2 −AC(27)
Q′′2 =BQ1 −AQ2
B2 −AC(28)
Thus, for each point in space, x, we would increase the
density value at x by Q′′1G1(x) +Q′′2G2(x).
In practice, if match point xi covers an area with rel-
atively smooth density distribution, the closeness func-
tionH evaluates close to 1. This brings the denominator
B2 − AC close to 0. In such cases, we revert back to
Equation 11 for a standard Gaussian spread.
6 Results
We have implemented our automated sampling and con-
trol system within an Eulerian fluid smoke simulator.
All simulations were run on a PC with Intel Core i7 Pro-
cessor at 4.5GHz. We employ BFECC [10] and mono-
tonic cubic interpolation [3] for advection. Identical time
steps were used in low and high resolution. We have de-
fined a few constants as minima for selecting regions in
Section 4.1. For the thresholds in Equation 13, 14 and
15, we have found that even small amount of density
(0.01 when density is normalized to [0,1]) is perceivable
after rendering. Thus, in our examples we use small val-
ues (0.01) for dmin, ∆dmin and ωmin, to avoid floating
point error and ensure all visible effects are matched.
We illustrate our method with the following exam-
ples. Please refer to the accompanying video for more
examples, and more complete version of the simula-
tions. In all of our examples except the user interface
demo, no manual configuration of match points is needed.
All match points are automatically generated by our
sampling method described in Section 4.
8 Ruoguan Huang, John Keyser
Fig. 2 On the left is the low resolution preview simulation. The second column is the results of [9]. 2a is without densitycontrol and 2b is with. The third column is our results. 3a is without density control, 3b and 3c are with. 3b uses a standardGaussian kernel while 3c uses a bilateral kernel. On the right is the uncontrolled high resolution simulation.
Figure 2 shows an example of simulation using our
automated sampling method with bilateral density sam-
pling and compares it to the method of Huang et al. [9]
that covers the domain with uniformly placed match
points with fixed positions. Arrows indicate one place
where differences are more obvious. The comparison be-
tween the two methods (Figure 2.2a and Figure 2.3a)
without density control shows that our advected match
points cause the flow to more closely match desired be-
haviors instead of waiting for the differences to appear
and then correcting them. Feature detection based sam-
pling significantly reduces the number of match points
used, and therefore requires much less computational
overhead. The number of match points used in this ex-
ample by our method is approximately one fourth of
that used in [9], which brings down the extra time (rel-
ative to an uncontrolled simulation) spent on the con-
trol process from 80% to 20%. The density control of
Huang et al. [9] (Figure 2.2b) shows some areas with
unmatched density while the result of our method (Fig-
ure 2.3c) with age-based density control and temporal
blending smoothly matches the preview.
The comparison between Gaussian (Figure 2.3b) and
bilateral (Figure 2.3c) density sampling and distribu-
tion methods shows that the result using bilateral ker-
nels produces a closer match to the shape of the smoke
in the preview simulation than the one using Gaus-
sians. The effect of Gaussian kernels seems to reduce
the intensity of the smoke to match the preview, yet
makes no change to its overall shape. The effectiveness
of bilateral density sampling is further demonstrated
in Figure 3. In this example, we set up a simulation
with constant u = 0 everywhere and refresh the distri-
bution of match points every frame. The results after
just one iteration demonstrate the preservation of edges
by bilateral kernels compared to the blurring effect of
Gaussians. With further iterations, the advantage of bi-
lateral kernels is even clearer. To show each individual
match point more clearly, the match points generated
in (only) this example are restricted to have a larger
Automated Sampling and Control of Gaseous Simulations 9
Fig. 3 Bilateral density sampling and matching on a staticdensity field. Each row presents from left to right: the preview,the result using Bilateral kernels, the result using Gaussiankernels. The first and second row show the results after oneiteration with match points displayed along the first. Thethird is after 50 iterations.
minimum distance than used in other examples. In the
accompanying video, we slow down the matching pro-
cess so that the faster convergence rate will be obvious.
Figure 1 shows that the user can easily configure the
control of a simulation in selected regions and times.
The control is set up to start in the middle of the simu-
lation and is effective only in the projected volume from
a selected region in screen space. The user can also mod-
ify settings on a time line to determine the interval and
curve at which the control weights mri ramp up as the
simulation approaches the first fully controlled frame.
The result, as set up, is uncontrolled for the first part of
the simulation, and then starts to shift towards the pre-
view, and after a short transition, becomes completely
matched to the preview.
Figure 4 shows the animation of a walking charac-
ter of smoke. We apply modified Poisson disk distribu-
tion to fill the hull of the character with match points,
and sample the density and velocity by discretizing the
space on a coarse grid. We then use the sampled data
to drive the smoke animation in higher resolution.
We provide the timings and the number of match
points used in Table 1.
7 Conclusion
We have presented a collection of techniques that allow
preview-based control of gaseous fluid simulations to be
Fig. 4 On the left is the animated character of smoke. On theright is the corresponding frame from the motion sequence.
handled in a more automated and more accurate man-
ner. Methods presented for identifying key features in
a simulation, automatic Poisson sampling, and advec-
tion of match points allow simulations to be matched
more accurately and with fewer match points than with
uniform sampling, and with far more ease of use than
manual placement. Methods for temporal blending and
age weighting allow for smooth transitions into a con-
trolled region/time of the simulation. Finally, a bilateral
approach to sampling and matching is presented that
allows sharp gradients within the simulation to be cal-
culated much more accurately. Together, these methods
allow a user to have a much more usable, efficient, and
accurate control method.
There are several avenues that would be good to
explore in the future:
1. Automatically determining control weights to han-
dle very drastic change in the preview simulation
without involving the user.
2. Extending our sampling and matching methods to
an arbitrary style of control such as artistic direc-
tion.
3. Adapting our method to Lagrangian frameworks,
and perhaps liquid simulations.
Acknowledgements
This publication is based in part on work supported by
NSF Grant IIS-0917286 and by Award Number KUS-
CI-016-04, made by King Abdullah University of Sci-
ence and Technology (KAUST).
References
1. Angelidis, A., Neyret, F., Singh, K., Nowrouzezahrai, D.:A controllable, fast and stable basis for vortex based
10 Ruoguan Huang, John Keyser
Crossing Bar Rotating Bar Smoke Column StairsHuang et al. N/A N/A 1.20 1.44Ours 0.45 0.71 0.76 0.36Simulation 2.23 0.86 4.16 1.83
Number of Match Points Huang et al. N/A N/A 1536 3072Number of Match Points Ours 104 218 215 906
Table 1 The top three rows give timing information in average seconds per frame for the method of Huang et al. [9], ournew approach presented here, and the high resolution simulation without any control. The bottom rows present the averagenumber of match points used per frame in the two methods.
smoke simulation. In: Proceedings of the Eurograph-ics/ACM SIGGRAPH Symposium on Computer Anima-tion, pp. 25–32 (2006)
2. Fattal, R., Lischinski, D.: Target-driven smoke anima-tion. ACM Trans. Graph. 23(3), 441–448 (2004)
3. Fedkiw, R., Stam, J., Jensen, H.W.: Visual simulation ofsmoke. Proc. of ACM SIGGRAPH ’01 pp. 15–22 (2001)
4. Foster, N., Fedkiw, R.: Practical animation of liquids.Proceedings of ACM SIGGRAPH ’01 pp. 23–30 (2001)
5. Foster, N., Metaxas, D.: Realistic animation of liquids.Graphical Models and Image Processing (58(5)), 471–483(1996)
6. Foster, N., Metaxas, D.: Controlling fluid animation.Computer Graphics International pp. 178–188 (1997)
7. He, S., Lau, R.W.H.: Synthetic controllable turbulenceusing robust second vorticity confinement. Comput.Graph. Forum 32, 27–35 (2013)
8. Hong, J.M., Kim, C.H.: Controlling fluid animation withgeometric potential: Research articles. Comput. Animat.Virtual Worlds 15(3-4), 147–157 (2004)
9. Huang, R., Melek, Z., Keyser, J.: Preview-based samplingfor controlling gaseous simulations. In: Proceedings ofthe 2011 ACM SIGGRAPH/Eurographics Symposium onComputer Animation, pp. 177–186 (2011)
10. Kim, B., Liu, Y., Llamas, I., Rossignac, J.: Advectionswith significantly reduced dissipation and diffusion. IEEETransactions on Visualization and Computer Graphics13, 135–144 (2007)
11. Kim, T., Thurey, N., James, D., Gross, M.: Wavelet tur-bulence for fluid simulation. ACM Trans. Graph. 27,50:1–50:6 (2008)
12. Kim, Y., Machiraju, R., Thompson, D.: Path-based con-trol of smoke simulations. In: Proceedings of the Eu-rographics/ACM SIGGRAPH Symposium on ComputerAnimation, pp. 33–42 (2006)
13. Lagae, A., Dutre, P.: A comparison of methods for gener-ating poisson disk distributions. Comput. Graph. Forum27(1), 114–129 (2008)
14. McCool, M., Fiume, E.: Hierarchical poisson disk sam-pling distributions. In: Proceedings of the conference onGraphics interface ’92, pp. 94–105 (1992)
15. McNamara, A., Treuille, A., Popovic, Z., Stam, J.: Fluidcontrol using the adjoint method. ACM Transactions onGraphics 23(3), 449–456 (2004)
16. Muller, M., Charypar, D., Gross, M.: Particle-based fluidsimulation for interactive applications. In: Proceedingsof the 2003 ACM SIGGRAPH/Eurographics symposiumon Computer animation, pp. 154–159 (2003)
17. Narain, R., Sewall, J., Carlson, M., Lin, M.C.: Fast an-imation of turbulence using energy transport and pro-cedural synthesis. ACM Trans. Graph. 27, 166:1–166:8(2008)
18. Nielsen, M.B., Christensen, B.B., Zafar, N.B., Roble, D.,Museth, K.: Guiding of smoke animations through varia-tional coupling of simulations at different resolutions. In:
Proceedings of the 2009 ACM SIGGRAPH/EurographicsSymposium on Computer Animation, pp. 217–226 (2009)
19. Nielsen, M.B., Christiansen, B.B.: Improved variationalguiding of smoke animations. Computer Graphics Forum29, 705–712 (2010)
20. Pfaff, T., Thurey, N., Cohen, J., Tariq, S., Gross, M.:Scalable fluid simulation using anisotropic turbulenceparticles. ACM Trans. Graph. 29, 174:1–174:8 (2010)
21. Pighin, F., Cohen, J.M., Shah, M.: Modeling and edit-ing flows using advected radial basis functions. In: Proc.ACM SIGGRAPH/Eurographics Symposium on Com-puter Animation, pp. 223–232 (2004)
22. Rasmussen, N., Enright, D., Nguyen, D., Marino, S.,Sumner, N., Geiger, W., Hoon, S., Fedkiw, R.: Di-rectable photorealistic liquids. In: SCA ’04: Proceedingsof the 2004 ACM SIGGRAPH/Eurographics symposiumon Computer animation, pp. 193–202 (2004)
23. Schechter, H., Bridson, R.: Evolving sub-grid turbu-lence for smoke animation. In: Proceedings of the 2008ACM SIGGRAPH/Eurographics Symposium on Com-puter Animation, pp. 1–7 (2008)
24. Schpok, J., Dwyer, W., Ebert, D.S.: Modeling and ani-mating gases with simulation features. In: Proceedingsof the Eurographics/ACM SIGGRAPH Symposium onComputer Animation, pp. 97–105 (2005)
25. Shi, L., Yu, Y.: Controllable smoke animation with guid-ing objects. ACM Trans. Graph. 24(1), 140–164 (2005)
26. Shi, L., Yu, Y.: Taming liquids for rapidly chang-ing targets. In: Proceedings of the 2005 ACM SIG-GRAPH/Eurographics symposium on Computer anima-tion, pp. 229–236 (2005)
27. Stam, J.: Stable fluids. Proc. of ACM SIGGRAPH ’99pp. 121–128 (1999)
28. Steinhoff, J., Fan, M., Wang, L., Dietz, W.: Convectionof concentrated vortices and passive scalars as solitarywaves. J. Sci. Comput. 19(1-3), 457–478 (2003)
29. Thurey, N., Keiser, R., Pauly, M., Rude, U.: Detail-preserving fluid control. In: Proceedings of the 2006 ACMSIGGRAPH/Eurographics symposium on Computer an-imation, pp. 7–12 (2006)
30. Tomasi, C., Manduchi, R.: Bilateral filtering for gray andcolor images. In: Proceedings of the Sixth InternationalConference on Computer Vision, pp. 839– (1998)
31. Treuille, A., McNamara, A., Popovic, Z., Stam, J.:Keyframe control of smoke simulation. ACM Transac-tions on Graphics 22(3), 716–723 (2003)
32. Yuan, Z., Chen, F., Zhao, Y.: Pattern-guided smoke ani-mation with lagrangian coherent structure. In: Proceed-ings of the 2011 SIGGRAPH Asia Conference, pp. 136:1–136:8 (2011)