0% found this document useful (0 votes)
61 views

Curl-Noise For Procedural Fluid Flow

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Curl-Noise For Procedural Fluid Flow

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Curl-Noise for Procedural Fluid Flow

Robert Bridson∗ Jim Hourihan† Marcus Nordenstam‡


University of British Columbia Tweak Films Double Negative

Abstract
Procedural methods for animating turbulent fluid are often pre-
ferred over simulation, both for speed and for the degree of ani-
mator control. We offer an extremely simple approach to efficiently
generating turbulent velocity fields based on Perlin noise, with a
formula that is exactly incompressible (necessary for the character-
istic look of everyday fluids), exactly respects solid boundaries (not
allowing fluid to flow through arbitrarily-specified surfaces), and
whose amplitude can be modulated in space as desired. In addition,
we demonstrate how to combine this with procedural primitives for
flow around moving rigid objects, vortices, etc.
CR Categories: I.3.7 [Computer Graphics]: Three-Dimensional
Graphics and Realism—Animation
Keywords: noise, turbulence, fluids, procedural animation
Figure 1: Incompressible 2D noise with solid boundaries. To com-
pute the potential ψ we multiply scaled noise N(~x,t) by a modu-
1 Introduction lation function (a smoothed step function A of distance from the
Many shots in films and effects in games call for fluid-like turbulent mouse cursor) and a ramp to zero based ondistanced(~x)to the
motion, particularly for smoke and vapor. Though simulation of the d(~x) ~x
closest solid boundary: ψ (~x,t) = ramp d0 A(~x) N d0 ,t . The
equations of fluid motion can generate spectacular animation, it can
velocity field is the curl of this potential: ~v = ∇ × ψ .
be frustratingly slow and unwieldy to direct. Many practitioners
instead turn to procedural methods where the state of the system,
such as the velocity field of the fluid, can be cheaply and repeatably that if just a few point samples of wind velocity are required (as
evaluated anywhere in space and time—without discretizing PDE’s, in his modal tree dynamics) there is no need for storing and cal-
without large grids, without simulation parameters to tweak, with- culating the full 3D domain; however, the approach is inefficient
out solving systems of equations, and with immediate and direct for large numbers of samples (e.g. when advecting large numbers
animator control. After reviewing some previous procedural meth- of particles), and doesn’t solve the problem of modulating Fourier
ods and their drawbacks, we offer a new, fast and simple procedural synthesized fields.
approach for constructing fluid-like velocity fields.
Perlin’s eponymous noise function [1985; 2002] is frequently used
Both Sims [1990] and Wejchert and Haumann [1991] used a linear in practice to generate random velocity fields; however, these fields
superposition of “flow primitives” such as vortices, sources, sinks, generally contain many sinks (“gutters” where particles accumu-
and particular solutions of potential flow to generate plausible wind late) since they are not divergence-free. The divergence-free con-
velocity fields. However, without manually adding many vortices, dition, ∇ ·~v = 0, is equivalent to stating the fluid is incompressible,
this approach is restricted to fairly laminar flow, and matching the and is one extremely important visual characteristic of everyday
flow to arbitrary solid geometry is not handled. fluids (e.g. water, air, and smoke).

Shinya and Fournier [1992] and Stam and Fiume [1993] used Perlin and Neyret [2001] also created time-varying textures which
Fourier synthesis to produce physically plausible turbulent velocity appear to flow, but cannot be used for moving particle systems and
fields. However, arbitrary solid boundaries cannot be handled with cannot naturally handle arbitrary solid geometry.
this method, the entire 3D domain must be computed and stored
(particularly difficult in the constrained memory environment of Lamorlette and Foster [2002] use procedural methods including a
game consoles), and artist control such as spatially modulating the Fourier-synthesized turbulence model to animate flames, and also
magnitude of the turbulence is lost. Later, Stam [1997] showed provide good argument as to why procedural methods can be prefer-
able to fluid simulation.
∗ e-mail: rbridson@cs.ubc.ca
† e-mail: jimh@tweakfilms.com Kniss and Hart [2004] demonstrated the idea of using the curl of
‡ e-mail: mkn@dneg.com Perlin noise (as we do) for incompressible flow fields; our paper
extends this to handle boundary conditions and other effects.
ACM Reference Format
Bridson, R., Hourihan, J., Nordenstam, M. 2007. Curl-Noise for Procedural Fluid Flow. ACM Trans. Graph. Patel and Taylor [2005] introduce “fast simulation noise”, a
26, 3, Article 46 (July 2007), 3 pages. DOI = 10.1145/1239451.1239497 http://doi.acm.org/10.1145/12394
51.1239497.
divergence-free velocity field that can be evaluated similar to Perlin
noise. While similar in spirit to our method, it suffers from either a
Copyright Notice
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted lack of smoothness or periodic dead spots (points of zero velocity)
without fee provided that copies are not made or distributed for profit or direct commercial advantage
and that copies show this notice on the first page or initial screen of a display along with the full citation.
and it cannot yet handle arbitrary solid boundaries as we do below.
Copyrights for components of this work owned by others than ACM must be honored. Abstracting with
credit is permitted. To copy otherwise, to republish, to post on servers, to redistribute to lists, or to use any Finally von Funck et al. [2006] build divergence-free velocity fields
component of this work in other works requires prior specific permission and/or a fee. Permissions may be
requested from Publications Dept., ACM, Inc., 2 Penn Plaza, Suite 701, New York, NY 10121-0701, fax +1 for shape deformation with a slightly different construction. While
(212) 869-0481, or permissions@acm.org.
© 2007 ACM 0730-0301/2007/03-ART46 $5.00 DOI 10.1145/1239451.1239497
it is not clear how to adapt this approach to handle boundaries, it
http://doi.acm.org/10.1145/1239451.1239497 could in principle also be used for our application.
ACM Transactions on Graphics, Vol. 26, No. 3, Article 46, Publication date: July 2007.
46-2 • Bridson et al.

2 The Method

2.1 Curl

In a nutshell, we use the curl ∇× of a potential field ψ for ve-


locities. In three dimensions, the potential is a vector-valued field
~ = (ψ1 , ψ2 , ψ3 ), giving:
ψ
 
∂ ψ3 ∂ ψ2 ∂ ψ1 ∂ ψ3 ∂ ψ2 ∂ ψ1
~v(x, y, z) = − , − , − (1)
∂y ∂z ∂z ∂x ∂x ∂y

and in two dimensions the potential is a simple scalar field, giving: Figure 2: On the left, we construct a turbulent wake behind a rigid
  body. On the right, we set up a vortex ring to push fluid past a
∂ψ ∂ψ sphere before diffusing by turbulent mixing. In both cases each oc-
~v(x, y) = ,− , . (2)
∂y ∂x tave of turbulence noise is adjusted
 in a scale-appropriate
  way to
d(x) x t
the geometry: ψT (x) = ∑i ai ramp di N di , di . We then mul-
We recall from fluid dynamics that the potential in 2D may be called
the “stream function”: its isocontours are the streamlines of the tiply by a smooth amplitude function to create turbulence only be-
flow. hind the obstacles, and add this to the underlying laminar flow po-
tential which is also smoothly ramped  to zero at solid boundaries:
A classic vector calculus identity is that the curl of a smooth poten-

ψ (x,t) = A(x) ψT (x,t) + ramp d(x)
dL ψL (x). (In 3D, only tangen-
tial is automatically divergence-free: ∇ · ∇× ≡ 0. Thus the velocity
field we have constructed is divergence-free, ∇ ·~v = 0, i.e. it is in- tial components of vector noise are ramped down; see equation 5).
compressible. No sources or sinks (“gutters”) are possible.
To evaluate the partial derivatives, we use simple finite difference decay to zero away from objects in the scene, or changing it accord-
approximations with a very small displacement (e.g. in our exam- ing to the height in a column of smoke. While simply modulating
ples we have used a displacement 10−4 times smaller than the do- the velocity field A(~x)~v(~x) no longer gives a divergence-free field,
main, which works fine in single precision); this makes it easy to modulating the potential, ~v = ∇ × (A(~x)ψ (~x)), does the trick.
use even quite complicated potentials.
2.4 Boundaries
2.2 Noise Consider a motionless solid object in the flow. The boundary con-
To construct a randomly varying velocity field we use Perlin noise dition viscous flow must satisfy is ~v = 0. This can be achieved sim-
N(~x) in our potential. In 2D, ψ = N. In 3D we need three com- ply by modulating the potential down to zero with a smoothed step
ponents for the potential: three apparently uncorrelated noise func- function of distance, so that all the partial derivatives (and hence
the curl) of the new potential are zero at the boundary.
tions (a vector ~N(~x)) do the job, which in practice can be the same
noise function evaluated at large offsets. Of more interest in animation is the inviscid boundary condition,
~v ·~n = 0, requiring that the component of velocity normal to the
Note that if the noise function is based on the integer lattice and
boundary is zero—allowing the fluid to slip past tangentially but
smoothly varies in the range [−1, 1], then the partial derivatives
not to flow through a solid. Most turbulent fluids have such small
of the scaled N(x/L) will vary over a length-scale L with values
viscosities that this is a more reasonable approximation.
approximately in the range O([−1/L, 1/L]). This means we can
expect vortices of diameter approximately L and speeds up to ap- In two dimensions, note that our velocity field is just the 90◦ rota-
proximately O(1/L): the user may use this to scale the magnitude tion of the gradient ∇ψ : if we want the velocity field to be tangent
of ψ to get a desired speed. to the boundary, we need the gradient to be perpendicular to the
boundary. This happens precisely when the boundary is an isocon-
The usual trick of adding several octaves at different scales together tour of ψ , i.e. when ψ has some constant value along the boundary.
to get “turbulent noise” (in the graphics sense [Perlin 1985]; see We can achieve this without eliminating the gradient altogether by
also Cook and DeRose’s wavelet noise [2005]) actually, in this case, modulating ψ with a ramp through zero based on distance to the
produces something quite similar to physical turbulence. Using a closest boundary point:
power law to reduce the magnitude of velocities from smaller-scale
vortices, as in the Kolmogorov turbulence spectrum, has a sound
 
d(~x)
physical basis (for a discussion of using the Kolmogorov model for ψconstrained (~x) = ramp ψ (~x) (3)
d0
synthesizing velocity fields see e.g. Stam and Fiume [1993], and for
time modulating noise textures see Neyret [2003]). where d(~x) is the distance to all solid boundaries and d0 is the width
We finally note that for added realism, our velocity field should vary of the modified region—when using noise with length scale L, it
in time. This is achieved very simply by using time-varying noise. makes sense to set d0 = L. We use the following smooth ramp:
While we have not yet tried it, it seems profitable to look at the 
1 : r≥1
pseudo-advection ideas of FlowNoise [Perlin and Neyret 2001] to

15
ramp(r) = 8 r − 10
8 r3 + 83 r5 : 1 > r > −1 (4)
give more realism to the evolution of the turbulent vortices.
−1 : r ≤ −1

2.3 Modulation
In three dimensions things are a little more complicated. Letting
We are not restricted to linear superposition of potentials: thanks α = |ramp(d(~x)/d0 )| and n̂ be the normal to the boundary at the
to the curl identity, we may manipulate ψ as we like and still be closest point to ~x, we use
sure of getting an incompressible velocity field. The simplest of
such controls is to spatially modulate the flow: e.g. letting the field ~ constrained (~x) = α ψ
ψ ~ (~x) + (1 − α )n̂(n̂ · ψ
~ (~x)). (5)
ACM Transactions on Graphics, Vol. 26, No. 3, Article 46, Publication date: July 2007.
Curl-Noise for Procedural Fluid Flow • 46-3

That is, we ramp down the tangential component of ψ ~ near the 3 Conclusion
boundary, but leave the normal component unchanged. This can be
proven to give a tangential velocity field at smooth object bound- In figures 1 and 2 we show some screenshots of simple turbulence
aries, using the fact that n̂ is the gradient of signed distance from examples constructed with the basic formulas in this paper, running
the boundary (hence its curl vanishes). in real-time; see http://www.cs.ubc.ca/∼rbridson/ for ani-
mations, full details and code. In conclusion, using a simple vector
Unfortunately, the normal field may be discontinuous along the me- calculus identity, we have unlocked a new procedural toolbox for
dial axis of the geometry: naı̈vely using equation (5) can result in creating fluid-like velocity fields, including turbulent motion and
spikes when we take the curl, particularly near sharp edges. This flow around arbitrary rigid objects.
isn’t a problem for equation (3) since the distance field is Lipschitz
continuous, which is adequate for our purposes. Thus within dis- Acknowledgments
tance d0 of edges flagged as sharp in the system we default to (3),
i.e. drop the normal component. In the future we plan to investigate This work was in part supported by a grant from the Natural Sci-
more sophisticated solutions. ences and Engineering Research Council of Canada. We also thank
the anonymous reviewers for their considerable help in preparing
2.5 Other Potentials the work for publication.
So far we have only constructed noise that respects unmoving solid
boundaries. While of course we can superimpose existing flow References
primitives on the velocity field for richer capabilities, we can also
do more with the potential itself. C OOK , R. L., AND D E R OSE , T. 2005. Wavelet noise. ACM Trans.
Graph. (Proc. SIGGRAPH) 24, 3, 803–811.
It is simple to derive a potential corresponding to a rigid body mo-
tion with linear velocity ~V and angular velocity ω
~: K NISS , J., AND H ART, D., 2004. Volume effects: mod-
eling smoke, fire, and clouds. Section from ACM
R2 − ||~x −~x0 ||2 SIGGRAPH 2004 courses, Real-Time Volume Graphics,
~ rigid (~x) = ~V × (~x −~x0 ) +
ψ ~
ω (6) http://www.cs.unm.edu/ jmk/sig04 modeling.ppt.
2
where ~x0 is an arbitrary reference point and R is an arbitrary ref- L AMORLETTE , A., AND F OSTER , N. 2002. Structural modeling of
erence level. (Note that there are always infinitely many potentials flames for a production environment. In Proc. ACM SIGGRAPH,
corresponding to the same ~v: any two potentials which differ by 729–735.
only the gradient of some scalar field have exactly the same curl.) N EYRET, F. 2003. Advected textures. In Proc. Symp. Comp. Anim.,
Suppose we have a potential ψ ~ we wish to modify to respect bound- 147–153.
ary conditions on a moving rigid object. First we use equation (5) PATEL , M., AND TAYLOR , N. 2005. Simple divergence-free fields
to zero out the normal component of velocity on the object’s sur- for artistic simulation. journal of graphics tools 10, 4, 49–60.
face, giving ψ~ 0 . Then we use equation (6) with x0 chosen, say, as
the center of the rigid body, smoothly blend it to zero away from P ERLIN , K., AND N EYRET, F. 2001. Flow noise. In ACM SIG-
the object (choosing R to be the radius of the blend region, so that GRAPH Technical Sketches and Applications, 187. http://www-
the blended rotational term drops monotonically to zero), and add evasion.imag.fr/Publications/2001/PN01/.
~ (~x) = ψ
it to get ψ ~ 0 + A(~x)~
ψrigid (~x). We have experimented, for
example, with a blending function A(~x) based on inverse squared P ERLIN , K. 1985. An image synthesizer. In Proc. ACM SIG-
distance to each rigid body. Note that at the boundary of the rigid GRAPH, 287–296.
object, the velocity is the sum of the rigid motion and a vector field P ERLIN , K. 2002. Improving noise. ACM Trans. Graph. (Proc.
tangent to the surface: by construction this respects the inviscid SIGGRAPH) 21, 3, 681–682.
boundary condition.
S HINYA , M., AND F OURNIER , A. 1992. Stochastic motion: Mo-
While for a single body the reference point is arbitrary, if we have tion under the influence of wind. In Proc. Eurographics, 119–
multiple bodies it can help to use the same reference point to make 128.
the blend better. In particular, if all bodies are moving with the
same rigid motion, then of course we want their potentials to match S IMS , K. 1990. Particle animation and rendering using data parallel
up to make the blend perfect. computation. In Proc. ACM SIGGRAPH, 405–413.

Flow fields around deforming bodies are trickier. For a closed de- S TAM , J., AND F IUME , E. 1993. Turbulent wind fields for gaseous
forming surface, it may even be impossible—if the body doesn’t phenomena. In Proc. ACM SIGGRAPH, 369–376.
conserve its volume—and thus we leave that for future work. S TAM , J. 1997. Stochastic dynamics: Simulating the effects of tur-
Some vortex primitives include a simple vortex particle at ~x0 with bulence on flexible structures. Computer Graphics Forum (Proc.
angular velocity ω ~ , radius R, and smooth fall-off function f : Eurographics) 16, 3, C159–C164.

||~x −~x0 || R2 − ||~x −~x0 ||2
 VON F UNCK , W., T HEISEL , H., AND S EIDEL , H.-P. 2006. Vec-
~ vort (~x) = f
ψ ~,
ω (7) tor field based shape deformations. ACM Trans. Graph. (Proc.
R 2 SIGGRAPH) 25, 3, 1118–1125.
and a simple vortex curve, useful for smoke rings and plumes: W EJCHERT, J., AND H AUMANN , D. 1991. Animation aerodynam-
ics. In Proc. ACM SIGGRAPH, 19–22.
||~x −~xC || R2 − ||~x −~xC ||2
 
~ curve (~x) = f
ψ ~C
ω (8)
R 2
~ C is the angular
where~xC is the closest point on the curve to~x, and ω
velocity (tangent to the curve). Other interesting flow structures can
be similarly created with the rigid motion formulas in mind.
ACM Transactions on Graphics, Vol. 26, No. 3, Article 46, Publication date: July 2007.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy