# Patent

## Title
Method and system for vorticle fluid simulation

## Abstract

The disclosure provides an approach for animating gases. A dynamic model is employed that accounts for stretching of gas vorticles in a stable manner, handles isolated particles and buoyancy, permits deformable boundaries of objects the gas flows past, and accounts for vortex shedding. The model models stretching of vorticity by applying a vector at the center of a stretched vorticle. High frequency eddies resulting from stretching may be filtered by unstretching the vorticle while preserving mean energy and enstrophy. To model boundary pressure, a boundary may be imposed by embedding into the gas the surface boundary and setting boundary conditions based on velocity of the boundary and the Green's function of the Laplacian. For computational efficiency, a vorticle cutoff proportional to a vorticle's size may be imposed. Vorticles determined to be similar based on a predefined criteria and distance threshold may be fused.

## Background
BACKGROUND
Field of the Invention
This disclosure provides techniques for rendering images. More specifically, this disclosure presents techniques for simulating and rendering a gas using vorticles.
Description of the Related Art
The simulation of gases in three dimensions has been used for visual effects, such as those in computer animations. Traditional techniques for simulating gases typically use voxel grids and solve pressure in such grids. However, the animation of gases can be complex and inefficient using such traditional techniques. In addition, controlling the motion of gas to meet the artistic needs of an animator is often challenging, as gases usually do not have a well-defined surface and can vary dramatically over time.
SUMMARY
One embodiment provides a computer implemented method for rendering animation frames depicting gaseous matter. The method generally includes, for each of a plurality of time steps: creating vorticles via at least one of vortex shedding, buoyancy, and emitting vorticles; determining a harmonic field which makes flow of the gas an ideal nonviscous flow; determining a velocity field which is a sum of the harmonic field and a field induced by one or more of the vorticles on boundary points placed on one or more moving objects; advecting visual particles, density particles, and the vorticles using the velocity field; and rendering the visual particles in an image frame.
Further embodiments include a non-transitory computer-readable storage medium storing instructions that when executed by a computer system cause the computer system to perform the method set forth above, and a computer system programmed to carry out the method set forth above.



BRIEF DESCRIPTION OF THE DRAWINGS
The patent or application file contains at least one drawing executed in color. Copies of this patent or patent application publication with color drawing(s) will be provided by the Office upon request and payment of the necessary fee.
So that the manner in which the above recited aspects are attained and can be understood in detail, a more particular description of embodiments of the invention, briefly summarized above, may be had by reference to the appended drawings.
It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
FIG. 1 illustrates an example rendering of a gas, according to an embodiment.
FIG. 2 illustrates example velocity fields induced by a vorticle, according to an embodiment.
FIG. 3 illustrates example vorticles being stretched and unstretched, according to an embodiment.
FIG. 4 illustrates an example density particle emitting a ring of vorticles, according to an embodiment.
FIG. 5 illustrates an example harmonic field, according to an embodiment.
FIG. 6 illustrates an example of vorticle shedding, according to an embodiment.
FIG. 7 illustrates a method for rendering a gas, according to an embodiment.
FIG. 8 illustrates a system in which an embodiment may be implemented.



DETAILED DESCRIPTION
This disclosure presents techniques for efficient and controllable animation of gases. In contrast to traditional voxel grid based simulation, techniques disclosed herein employ a Lagrangian vorticle-based simulation. Generally, as used herein a vorticle is a vorticity particle that produces paddle-wheel like velocity, and each vorticle carries a volume of vorticity. A novel dynamic model is introduced that accounts for stretching of gas vorticles in a stable manner, handles isolated particles and buoyancy, permits deformable boundaries of objects the gas flows past, and accounts for vortex shedding in which vorticles are emitted. Vorticles are not just carried by flow, but typically also need to be squashed and stretched (elongated along one axis and scaled down along other axes). One embodiment squashes and stretches vorticles in a manner that preserves the mean velocity and vorticity of flow. In such an embodiment, the dynamic model may model stretching of vorticity by applying a vector at the center of a stretched vorticle. High frequency eddies resulting from the stretching may be filtered by unstretching the stretchable vorticle in a manner that preserves both the mean energy and enstrophy of the stretchable vorticle.
To model boundary pressure, the dynamic model imposes a boundary by embedding into the gas the surface boundary and setting boundary conditions based on a determined velocity of the boundary and the Green's function of the Laplacian. Deformable boundaries are formulated in a manner that only requires dot products, rather than solving linear systems around a colliding object as in traditional techniques. In one embodiment, the dynamic model may also impose a vorticle cutoff proportional to a vorticle's size. Doing so may improve computational efficiency during the rendering process. Such a vorticle cutoff provides an adjustable trade-off between the fall-off's physically based properties and spatially localized computations. In still another embodiment, vorticles that are determined to be similar based on a predefined criteria and distance threshold are fused, which also improves computational efficiency.
Referring now to FIG. 1, an example rendering of a gas is depicted, according to one embodiment. Panel A shows an object 101 moving through a vertical current of gas, which is simulated using a number (e.g., 2400) of vorticles 102i. To render the gas, a simulation application emits particles having densities into the flow of the gas, the densities are advected, and particle densities and velocities are splatted into a volume. Advection refers to transport by a fluid due to the fluid's bulk motion. The resulting rendering is depicted in panel B. To improve computational efficiency, vorticles which are sufficiently similar and close may be fused, certain vorticles such as those outside a viewing frustrum may be deleted, and vorticles may also be attenuated.
In one embodiment, the equation of motion for rendering the gas may be obtained by applying the curl operator to both sides of the following form of the Navier-Stokes Equation of a viscous incompressible Newtonian fluid, dividing both sides by ρ, and replacing ∇ρ/ρ with ∇ log(ρ)




  
    
      
        
          ρ
          ⁢
          
            
              d
              ⁢
              
                v
                →
              
            
            dt
          
        
        =
        
          
            μ
            ⁢
            
              
            
            ⁢
            
              
                ∇
                2
              
              ⁢
              
                v
                →
              
            
          
          +
          
            ρ
            ⁢
            
              F
              →
            
          
          -
          
            
              ∇
              p
            
            .
          
        
      
    
    
      
        (
        1
        )
      
    
  




The following equation may then be obtained to solve for motion, where the vorticity {right arrow over (ω)} is defined as the curl of the velocity {right arrow over (v)}





  
    
      
        
          
            d
            ⁢
            
              ω
              →
            
          
          dt
        
        =
        
          
            
              (
              
                
                  ω
                  →
                
                ·
                ∇
              
              )
            
            ⁢
            
              v
              →
            
          
          +
          
            
              μ
              ρ
            
            ⁢
            
              
                ∇
                2
              
              ⁢
              
                ω
                →
              
            
          
          +
          
            
              ∇
              
                log
                ⁡
                
                  (
                  ρ
                  )
                
              
            
            ×
            
              (
              
                
                  F
                  →
                
                -
                
                  
                    d
                    ⁢
                    
                      v
                      →
                    
                  
                  dt
                
              
              )
            
          
          +
          
            ∇
            
              ×
              
                
                  F
                  →
                
                .
              
            
          
        
      
    
    
      
        (
        2
        )
      
    
  




Equation (2) means that the vorticity {right arrow over (ω)} evolves over time by advecting a Lagrangian frame of reference (a particle) that carries the vorticity {right arrow over (ω)}, as well as stretching {right arrow over (ω)} according to the velocity {right arrow over (v)}, with dynamic viscosity μ, buoyancy and boundary interaction specified by density ρ, and external forces {right arrow over (F)} given by





  
    
      
        
          
            F
            →
          
          ⁡
          
            (
            p
            )
          
        
        =
        
          {
          
            
              
                
                  
                    
                      g
                      →
                    
                    +
                    
                      e
                      →
                    
                  
                
                
                  
                    if
                    ⁢
                    
                      
                    
                    ⁢
                    p
                    ⁢
                    
                      
                    
                    ⁢
                    outside
                    ⁢
                    
                      
                    
                    ⁢
                    solid
                    ⁢
                    
                      
                    
                    ⁢
                    objects
                  
                
              
              
                
                  
                    f
                    →
                  
                
                
                  otherwise
                
              
            
            ,
          
        
      
    
    
      
        (
        3
        )
      
    
  




where {right arrow over (g)} is the constant for gravity, {right arrow over (f)} is the acceleration at the objects' boundaries suitable for deformable objects, and {right arrow over (e)} represents user defined external forces. Density is assumed to be strictly greater than 0. In addition, the velocity {right arrow over (v)} that is needed for advection may be obtained from the vorticity {right arrow over (ω)} by inverting the curl operator with the Biot-Savart law and an irrotational (i.e., not rotating) and solenoidal field {right arrow over (h)}





  
    
      
        
          
            
              u
              →
            
            ⁡
            
              (
              p
              )
            
          
          =
          
            
              1
              
                4
                ⁢
                π
              
            
            ⁢
            
              
                ∫
                
                  x
                  ∈
                  
                    R
                    3
                  
                
              
              ⁢
              
                
                  
                    
                      
                        ω
                        →
                      
                      ⁡
                      
                        (
                        x
                        )
                      
                    
                    ×
                    
                      (
                      
                        p
                        -
                        x
                      
                      )
                    
                  
                  
                    
                      
                      
                        p
                        -
                        x
                      
                      
                    
                    3
                  
                
                ⁢
                
                  
                
                ⁢
                dx
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            v
            →
          
          =
          
            
              u
              →
            
            +
            
              
                h
                →
              
              .
            
          
        
      
    
    
      
        (
        4
        )
      
    
  




Equation (4) means that the flow {right arrow over (v)} is the sum of the velocity induced by a continuum of rotations of center x, axis {right arrow over (ω)} and angle ∥{right arrow over (ω)}/∥p−x∥3, with a pressure field {right arrow over (h)} that models the boundary condition.

FIG. 2 illustrates example velocity fields induced by a vorticle, according to an embodiment. In one embodiment, a vorticle basis is used that accounts for stretching in a stable manner. The integral inside equation (4) may be kept, while introducing a vorticle partitioning (Vi,{right arrow over (ω)}i), where {right arrow over (ω)}i denotes the vorticity field induced by vorticle i




  
    
      
        
          
            u
            →
          
          ⁡
          
            (
            p
            )
          
        
        =
        
          
            1
            
              4
              ⁢
              π
            
          
          ⁢
          
            
              ∫
              
                x
                ∈
                
                  V
                  i
                
              
            
            ⁢
            
              
                
                  
                    
                      
                        ω
                        →
                      
                      i
                    
                    ⁡
                    
                      (
                      x
                      )
                    
                  
                  ×
                  
                    (
                    
                      p
                      -
                      x
                    
                    )
                  
                
                
                  
                    
                    
                      p
                      -
                      x
                    
                    
                  
                  3
                
              
              ⁢
              
                
              
              ⁢
              
                dx
                .
              
            
          
        
      
    
    
      
        (
        5
        )
      
    
  




The singularity of equation (5) at p=x could be removed by integrating analytically the vorticity over the partition or with a regularizing constant. To avoid this laborious integral and avoid an arbitrary post-simulation blurring filter size, the vorticity field may be defined instead as the sum of the curl of the vorticle's velocity field, as shown in FIG. 2, which illustrates slices of two example velocity fields induced by vorticles 201-202 in panels A and B. This is in contrast to defining vorticity as interpolated from point values, and this guarantees a divergence free vorticity and avoids instability from vorticity compression.

A vorticle itself is a vorticity particle defined by rotation strength {right arrow over (w)}i, center xi, and falloff φi(p). The velocity and vorticity fields induced by a vorticle are given by

{right arrow over (v)}i(p)=φi{right arrow over (w)}×(p−xi)  (6a)

{right arrow over (ω)}i(p)=2φi{right arrow over (w)}i+∇φi×({right arrow over (w)}i×(p−xi)).  (6b)

The falloff of a stretchable vorticle





  
    φ
    i
  
  =
  
    
      s
      i
    
    ⁢
    
      
        
          r
          i
          
            -
            
              5
              2
            
          
        
        (
        
          1
          +
          
            
              
                
                
                  
                    μ
                    i
                  
                  ⁡
                  
                    (
                    
                      
                        p
                        -
                        
                          x
                          i
                        
                      
                      
                        r
                        i
                      
                    
                    )
                  
                
                
              
              2
            
            2
          
        
        )
      
      
        -
        
          3
          2
        
      
    
  




and its gradient ∇φi are centered at xi, where ri is the vorticle's size, si is the stretching factor, and μi is the stretching function





  
    
      μ
      i
    
    ⁡
    
      (
      q
      )
    
  
  =
  
    
      1
      
        
          w
          →
        
        i
        2
      
    
    ⁢
    
      
        (
        
          
            
              
                S
                i
                
                  -
                  
                    4
                    5
                  
                
              
              ⁡
              
                (
                
                  
                    
                      w
                      →
                    
                    i
                  
                  ·
                  q
                
                )
              
            
            ⁢
            
              
                w
                →
              
              i
            
          
          +
          
            
              s
              i
              
                7
                10
              
            
            ⁢
            
              
                w
                →
              
              i
            
            ×
            q
            ×
            
              
                w
                →
              
              i
            
          
        
        )
      
      .
    
  




The following properties are satisfied by φi. First, φi revolves around {right arrow over (w)}i, and therefore {right arrow over (v)}i is divergence-free since its magnitude is constant along the streamlines of the rotation. Second, when the stretching factor is increased from si to si′, the vorticity {right arrow over (ω)}i is stretched by a factor





  
    s
    i
    ′
  
  
    s
    i
  




along {right arrow over (w)}i and squashed by





  
    
      s
      i
      ′
    
    
      s
      i
    
  




along any direction perpendicular to {right arrow over (w)}i, in accordance with the deformation induced by an incompressible flow, and satisfying Kelvin's circulation theorem. Third, stretching is conservative since the vorticle's mean energy Ei is independent of si





  
    
      
        
          E
          i
        
        =
        
          
            
              1
              2
            
            ⁢
            
              ∫
              
                
                  
                    v
                    →
                  
                  i
                  2
                
                ⁢
                dx
              
            
          
          =
          
            
              2
            
            ⁢
            
              π
              2
            
            ⁢
            
              
                
                  
                  
                    
                      w
                      →
                    
                    i
                  
                  
                
                2
              
              .
            
          
        
      
    
    
      
        (
        7
        )
      
    
  




A stretchable vorticle is thus defined by 4 variables {xi, {right arrow over (w)}i, ri, si}, and, as discussed in greater detail below, can further be reduced to a vorticle of 3 variables

{xi,{right arrow over (w)}i,ri}.  (8)

The velocity field is defined by summing the velocity field of multiple vorticles, as shown in FIG. 2, panel C. In panel C, three vorticles 203-205 orthogonal to a plane are shown, and the velocity field is the sum of the velocity fields of the individual vorticles.

FIG. 3 illustrates example vorticles being stretched and unstretched, according to an embodiment. As discussed, in vortex simulators, vorticles are not only carried by flow, but also need to be squashed and stretched. In one embodiment, discussed in greater detail below, such squashing and stretching is performed in a manner that preserves the mean velocity and vorticity of the flow. In particular, vorticles are modified so that they evolve while maintaining constant enstrophy and mean energy. Illustratively, the vorticle 301 in panel A is stretched into the vorticle 302 in panel B. The vorticle 302 in panel B is then resampled in an unstretched vorticle 303 shown in panel C, with the same mean energy and enstrophy as the vorticle 302 in panel B.
The term ({right arrow over (ω)}·∇){right arrow over (v)} in equation (2) models the stretching of vorticity. Stretching at a particular point xi may be measured by applying the velocity gradient to {right arrow over (ω)}i(xi)=2ri−5/2{right arrow over (w)}i, the self-induced vorticity at the center of an unstretched vorticle. Doing so gives




  
    
      
        
          
            
              d
              ⁢
              
                
                  ω
                  →
                
                i
              
            
            dt
          
          ⁢
          
            (
            
              x
              i
            
            )
          
        
        =
        
          
            ∑
            j
          
          ⁢
          
            
              
                w
                →
              
              j
            
            ×
            
              (
              
                
                  
                    
                      ∇
                      
                        
                          φ
                          j
                        
                        ⁡
                        
                          (
                          
                            x
                            i
                          
                          )
                        
                      
                    
                    ·
                    
                      
                        
                          ω
                          →
                        
                        i
                      
                      ⁡
                      
                        (
                        
                          x
                          i
                        
                        )
                      
                    
                  
                  ⁢
                  
                    (
                    
                      
                        x
                        i
                      
                      -
                      
                        x
                        j
                      
                    
                    )
                  
                
                +
                
                  
                    
                      φ
                      j
                    
                    ⁡
                    
                      (
                      
                        x
                        i
                      
                      )
                    
                  
                  ⁢
                  
                    
                      
                        
                          ω
                          →
                        
                        i
                      
                      ⁡
                      
                        (
                        
                          x
                          i
                        
                        )
                      
                    
                    .
                  
                
              
            
          
        
      
    
    
      
        (
        9
        )
      
    
  




Stretching produces a rotation of {right arrow over (w)}i and scaling of si.





  
    Let
    ⁢
    
      
    
    ⁢
    
      
        ω
        →
      
      i
      ′
    
  
  =
  
    
      
        ω
        →
      
      i
    
    +
    
      
        D
        t
      
      ⁢
      
        
          
            d
            ⁢
            
              
                ω
                →
              
              i
            
          
          dt
        
        .
      
    
  




The new rotation strength and stretch factors are then:





  
    
      
        
          
            w
            →
          
          i
          ′
        
        =
        
          
            
              
              
                
                  w
                  →
                
                i
              
              
            
            ⁢
            
              
                ω
                →
              
              i
              ′
            
          
          
            
            
              
                ω
                →
              
              i
              ′
            
            
          
        
      
    
    
      
        (
        10
        )
      
    
  
  
    
      
        
          s
          i
          ′
        
        =
        
          
            
              
              
                
                  ω
                  →
                
                i
                ′
              
              
            
            
              
              
                
                  ω
                  →
                
                i
              
              
            
          
          .
        
      
    
    
      
        (
        11
        )
      
    
  




The accumulation of stretching introduces increasingly high frequency velocities by transferring large scale eddies to smaller scale eddies. Although diffusion may filter eddies over long enough periods of time, instability may not be an option and high frequency eddies may need to be filtered explicitly in a predictable manner. Such filtering may be accomplished by unstretching the stretchable vorticle, as shown in panel C of FIG. 3, in a manner that preserves both Ei and the enstrophy Ωi of the unstretched vorticle





  
    
      
        
          Ω
          i
        
        =
        
          
            
              1
              2
            
            ⁢
            
              ∫
              
                
                  
                    ω
                    →
                  
                  i
                  2
                
                ⁢
                dx
              
            
          
          =
          
            
              
                3
                ⁢
                
                  
                    π
                    2
                  
                  ⁡
                  
                    (
                    
                      1
                      +
                      
                        4
                        ⁢
                        
                          s
                          i
                          
                            ′
                            3
                          
                        
                      
                    
                    )
                  
                
              
              
                16
                ⁢
                
                  2
                
                ⁢
                
                  r
                  i
                  2
                
                ⁢
                
                  s
                  i
                  
                    ′
                    
                      8
                      /
                      5
                    
                  
                
              
            
            ⁢
            
              
                
                  
                  
                    
                      w
                      →
                    
                    i
                  
                  
                
                2
              
              .
            
          
        
      
    
    
      
        (
        12
        )
      
    
  




Preserving Ei is trivial, as Ei is independent of si and ri in equation (7). To preserve Ωi, ri may be adjusted to a new size ri′





  
    
      
        
          r
          i
          ′
        
        =
        
          
            r
            i
          
          ⁢
          
            s
            i
            
              ′
              
                4
                /
                5
              
            
          
          ⁢
          
            
              
                5
                
                  1
                  +
                  
                    4
                    ⁢
                    
                      s
                      i
                      
                        ′
                        3
                      
                    
                  
                
              
            
            .
          
        
      
    
    
      
        (
        13
        )
      
    
  




With equation (13), the stretching factor can be restored to 1, as illustrated in panel C of FIG. 3. It can be verified that swapping {ri,si′} for {ri′,1} preserves Ωi. This step is a resampling step, where the same vorticle locations may be used. Note that resampling introduces an error, especially when squashing the vorticle, i.e., when the squashing factor is below 1. If substeps are taken, unstretching may be performed on full frames to avoid overfiltering. In one embodiment, limit resolutions may be set with a lower threshold rmin and upper threshold rmax on the vorticle size ri. Such a limit resolution loses enstrophy, but does not lose energy because of equation (7).

Equations (10)-(11) and (13) provide a way to apply stretching to a vorticle. The falloff and falloff gradient for an unstretched vorticle are




  
    
      
        
          
            φ
            i
          
          =
          
            
              
                r
                i
              
            
            ⁢
            
              
                (
                
                  
                    r
                    i
                    2
                  
                  +
                  
                    
                      
                        
                        
                          p
                          -
                          
                            x
                            i
                          
                        
                        
                      
                      2
                    
                    2
                  
                
                )
              
              
                -
                
                  3
                  2
                
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            ∇
            
              φ
              i
            
          
          =
          
            
              -
              
                3
                2
              
            
            ⁢
            
              
                r
                i
              
            
            ⁢
            
              
                (
                
                  
                    r
                    i
                    2
                  
                  +
                  
                    
                      
                        
                        
                          p
                          -
                          
                            x
                            i
                          
                        
                        
                      
                      2
                    
                    2
                  
                
                )
              
              
                -
                
                  5
                  2
                
              
            
            ⁢
            
              
                (
                
                  p
                  -
                  
                    x
                    i
                  
                
                )
              
              .
            
          
        
      
    
    
      
        (
        14
        )
      
    
  




When a vorticle becomes too small and approaches the fluid's Kolmogorov length, viscous forces dominate, and the vorticle strength is dissipated with {right arrow over (w)}i′=k{right arrow over (w)}i.

The dynamic model of equation (2) further includes a viscosity model that handles isolated particles. The viscosity model generally reduces the rotational strength of vorticles by an amount proportional to a measure of the number of surrounding vorticles or the surrounding emptiness. That is, isolated vorticles slow down by interacting with emptiness. The term




  
    μ
    ρ
  
  ⁢
  
    
      ∇
      2
    
    ⁢
    
      ω
      →
    
  




in equation (2) represents the diffusion of vorticity and models viscosity. In one embodiment,





  μ
  ρ




may be approximated with a constant kinematic viscosity ν, and the viscous model may be derived from the modified particle strength exchange (PSE) method, which normalizes the discrete integral to avoid a blow up. A term may also be added for handling isolated particles to model effectively the leakage of vorticity into the region of space with no vorticles. The PSE method is obtained by a Taylor expansion of {right arrow over (ω)}, reduced after multiplication with a normalized regularization function ηε. The result of this term is similar to artificial damping, but within the scope of the diffusion





  
    
      
        
          
            
              d
              ⁢
              
                
                  w
                  →
                
                i
              
            
            dt
          
          =
          
            
              v
              
                ε
                2
              
            
            ⁢
            
              (
              
                
                  
                    (
                    
                      1
                      -
                      
                        α
                        i
                      
                    
                    )
                  
                  ⁢
                  
                    
                      
                        ∑
                        j
                      
                      ⁢
                      
                        
                          V
                          j
                        
                        ⁢
                        
                          
                            η
                            ε
                          
                          ⁡
                          
                            (
                            
                              
                                x
                                j
                              
                              -
                              
                                x
                                i
                              
                            
                            )
                          
                        
                        ⁢
                        
                          (
                          
                            
                              
                                w
                                →
                              
                              j
                            
                            -
                            
                              
                                w
                                →
                              
                              i
                            
                          
                          )
                        
                      
                    
                    
                      
                        ∑
                        j
                      
                      ⁢
                      
                        
                          V
                          j
                        
                        ⁢
                        
                          
                            η
                            ε
                          
                          ⁡
                          
                            (
                            
                              
                                x
                                j
                              
                              -
                              
                                x
                                i
                              
                            
                            )
                          
                        
                      
                    
                  
                
                -
                
                  
                    α
                    i
                  
                  ⁢
                  
                    
                      w
                      →
                    
                    i
                  
                
              
              )
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              α
              i
            
            =
            
              
                ∏
                
                  j
                  ≠
                  i
                
              
              ⁢
              
                (
                
                  1
                  -
                  
                    
                      
                        η
                        ε
                      
                      ⁡
                      
                        (
                        
                          
                            x
                            j
                          
                          -
                          
                            x
                            i
                          
                        
                        )
                      
                    
                    
                      
                        η
                        ε
                      
                      ⁡
                      
                        (
                        0
                        )
                      
                    
                  
                
                )
              
            
          
          ,
        
      
    
    
      
        (
        15
        )
      
    
  




where αi is a measure of the isolation of particle i, ηε is the Gaussian PSE kernel, and Vi is the volume associated with vorticle i





  
    
      
        
          
            
              η
              ε
            
            ⁡
            
              (
              x
              )
            
          
          =
          
            
              1
              
                
                  2
                
                ⁢
                
                  ε
                  3
                
                ⁢
                
                  π
                  
                    3
                    /
                    2
                  
                
              
            
            ⁢
            
              exp
              (
              
                -
                
                  
                    
                      
                      x
                      
                    
                    2
                  
                  
                    2
                    ⁢
                    
                      ε
                      2
                    
                  
                
              
              )
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            V
            i
          
          =
          
            
              ∫
              
                
                  φ
                  i
                
                ⁢
                dx
              
            
            =
            
              2
              ⁢
              
                2
              
              ⁢
              
                π
                2
              
              ⁢
              
                
                  r
                  i
                
              
              ⁢
              
                
                  s
                  i
                  
                    2
                    /
                    5
                  
                
                .
              
            
          
        
      
    
    
      
        (
        16
        )
      
    
  




By using ε=√{square root over (νDt)}, the viscosity is more cheaply calculated for low ν and small time steps. This result can also be interpreted as a convolution with the heat kernel. Contrary to how viscosity was previously handled based on fluid mechanics, in which simulations were performed even in areas that were not visible, the approach discussed herein allows viscosity to leak into nothingness and vanish naturally instead of requiring a boundary that maintains viscosity around the data even in areas that are not visible.

FIG. 4 illustrates an example density particle emitting a ring of vorticles, according to an embodiment. To simulate buoyancy, vorticles (e.g., vorticles 401-406) are generated in rings around density particles carried by the flow, thereby creating a gust of wind up or down. The density particles can be user-configured to alter the buoyancy. When the position p is outside of solid objects, the term




  
    
      ∇
      
        log
        ⁡
        
          (
          ρ
          )
        
      
    
    ×
    
      (
      
        
          F
          →
        
        -
        
          
            d
            ⁢
            
              v
              →
            
          
          dt
        
      
      )
    
  
  +
  
    ∇
    
      ×
      
        F
        →
      
    
  




in equation (2) reduces to





  
    ∇
    log
  
  ⁢
  
    (
    ρ
    )
  
  ×
  
    (
    
      
        g
        →
      
      +
      
        e
        →
      
      -
      
        
          d
          ⁢
          
            v
            →
          
        
        dt
      
    
    )
  




and models the vorticity induced by buoyancy. New vorticles 401-406 are then produced from the density field ρ releasing potential energy, as shown in FIG. 4. Let ρ be defined with a set of particles carrying density and an ambient density ρA>0 so that the total density field ρ is strictly greater than 0, as required by equation (2)

ρ=ρA+Σρj.  (17)

Here, the subscript j is used to denote density particles, as opposed to subscript i for vorticles. The falloff ρj of a density particle j is centered at xj and may be defined in local coordinates qj=p−xj as





  
    
      
        
          ρ
          j
        
        =
        
          
            m
            j
          
          ⁢
          
            
              
                
                  exp
                  ⁡
                  
                    (
                    
                      
                        (
                        
                          1
                          +
                          
                            
                              κ
                              1
                            
                            ⁢
                            
                              
                                
                                  q
                                  j
                                
                                ·
                                
                                  q
                                  j
                                
                              
                              
                                2
                                ⁢
                                
                                  r
                                  j
                                  2
                                
                              
                            
                          
                        
                        )
                      
                      
                        -
                        
                          κ
                          2
                        
                      
                    
                    )
                  
                
                -
                1
              
              
                e
                -
                1
              
            
            .
          
        
      
    
    
      
        (
        18
        )
      
    
  




where mj is the multiplier of the particle density field and κi are fitting constants. As shown in FIG. 4, the newly induced vorticles are located along a ring of diameter rj perpendicular to





  
    g
    →
  
  +
  
    e
    →
  
  -
  
    
      
        d
        ⁢
        
          v
          →
        
      
      dt
    
    .
  




Instead of advecting an additional filament representation, the ring may be discretized with n new vorticles, equidistant for simplicity, and where n=2 in practice. Let the orthogonal unit vectors {right arrow over (a)} and {right arrow over (b)} be defined such that the cross product {right arrow over (a)}×{right arrow over (b)} has the direction of





  
    g
    →
  
  +
  
    e
    →
  
  -
  
    
      
        d
        ⁢
        
          v
          →
        
      
      dt
    
    .
  




Given n randomly selected samples αj, the new vorticles are, in the density particle's local coordinates,





  
    
      
        
          
        
        ⁢
        
          
            
              x
              
                α
                j
              
            
            =
            
              
                x
                j
              
              +
              
                
                  
                    r
                    j
                  
                  2
                
                ⁢
                
                  (
                  
                    
                      
                        cos
                        ⁡
                        
                          (
                          
                            α
                            j
                          
                          )
                        
                      
                      ⁢
                      
                        a
                        →
                      
                    
                    +
                    
                      
                        sin
                        ⁡
                        
                          (
                          
                            α
                            j
                          
                          )
                        
                      
                      ⁢
                      
                        b
                        →
                      
                    
                  
                  )
                
              
            
          
          ⁢
          
            

          
          ⁢
          
            
              
                w
                →
              
              
                α
                j
              
            
            =
            
              
                r
                j
              
              ⁢
              
                
                  r
                  j
                
              
              ⁢
              
                κ
                0
              
              ⁢
              
                π
                n
              
              ⁢
              
                
                
                  
                    g
                    →
                  
                  +
                  
                    e
                    →
                  
                  -
                  
                    
                      d
                      ⁢
                      
                        v
                        →
                      
                    
                    dt
                  
                
                
              
              ⁢
              
                
                  
                    
                      ρ
                      j
                    
                    ⁡
                    
                      (
                      
                        x
                        α
                      
                      )
                    
                  
                  +
                  
                    
                      m
                      j
                    
                    
                      e
                      -
                      1
                    
                  
                
                
                  
                    ρ
                    j
                  
                  ⁡
                  
                    (
                    
                      x
                      α
                    
                    )
                  
                
              
              ⁢
              
                (
                
                  
                    
                      –sin
                      ⁡
                      
                        (
                        
                          α
                          j
                        
                        )
                      
                    
                    ⁢
                    
                      a
                      →
                    
                  
                  +
                  
                    
                      cos
                      ⁡
                      
                        (
                        
                          α
                          j
                        
                        )
                      
                    
                    ⁢
                    
                      b
                      →
                    
                  
                
                )
              
            
          
          ⁢
          
            

          
          ⁢
          
            
          
          ⁢
          
            
              r
              
                α
                j
              
            
            =
            
              
                r
                j
              
              .
            
          
        
      
    
    
      
        (
        19
        )
      
    
  




FIG. 5 illustrates an example harmonic field, according to an embodiment. In one embodiment, the pressure field for boundaries is a harmonic field such as the field surrounding boundaries such as object 503, the initial position of which is shown in panel A. As shown in panel B, the harmonic field warps space from 501 to 502 in an incompressible and irrotational manner, with a slip boundary. The harmonic field is an induced velocity field derived from the velocity at the boundary of objects that affects vorticles around it. Conversely, new vorticles that are created may induce flows that change the harmonic field. The harmonic field is denoted herein by {right arrow over (h)}.
In equation (4), the harmonic field {right arrow over (h)} cancels the field induced by vorticles without adding vorticity. To define {right arrow over (h)}, 3 may be split with a surface δΩ enclosing volume Ω with normal {right arrow over (n)} pointing outside, and a volume Ωc the complementary of Ω. It can be shown that the Neumann boundary condition then defines {right arrow over (h)} restricted to Ωc as

{right arrow over (h)}Ωc(p)=δΩ{right arrow over (n)}·({right arrow over (v)}Ωc(x)−{right arrow over (u)}(x))∇G(p,x)dx.  (20)

Here,





  
    G
    ⁡
    
      (
      
        p
        ,
        x
      
      )
    
  
  =
  
    -
    
      1
      
        4
        ⁢
        π
        ⁢
        
          
          
            p
            -
            x
          
          
        
      
    
  




is function of the Laplacian, and {right arrow over (v)}Ωc is the velocity of the boundary. Using n panels of size ai and centroid xi, {right arrow over (h)} may be discretized using the falloffs

{right arrow over (h)}Ωc(p)=Σiai{right arrow over (n)}i·({right arrow over (v)}Ωc(xi)−{right arrow over (u)}(xi))∇G(p,xi).  (21)

To avoid the singularities of G when p approaches the boundary samples xi, the pathlines of the monopole based on a deformer may be used instead of equation (21). In such a case, for a point outside of the boundary,





  
    
      
        
          
            
              
                h
                ->
              
              
                Ω
                c
              
            
            ⁡
            
              (
              p
              )
            
          
          =
          
            
              
                1
                
                  D
                  t
                
              
              ⁢
              
                
                  ∑
                  i
                
                ⁢
                
                  ζ
                  ⁡
                  
                    (
                    
                      
                        p
                        -
                        
                          x
                          i
                        
                      
                      ,
                      
                        
                          D
                          t
                        
                        ⁢
                        
                          a
                          t
                        
                        ⁢
                        
                          
                            
                              n
                              ->
                            
                            i
                          
                          ·
                          
                            (
                            
                              
                                
                                  
                                    v
                                    ->
                                  
                                  
                                    Ω
                                    c
                                  
                                
                                ⁡
                                
                                  (
                                  
                                    x
                                    i
                                  
                                  )
                                
                              
                              -
                              
                                
                                  u
                                  ->
                                
                                ⁡
                                
                                  (
                                  
                                    x
                                    i
                                  
                                  )
                                
                              
                            
                            )
                          
                        
                      
                    
                    )
                  
                
              
            
            -
            
              (
              
                p
                -
                
                  x
                  i
                
              
              )
            
          
        
        ,
      
    
    
      
        (
        22
        )
      
    
  




where ζ, defined below, satisfies ζ(ζ(p,k0),ki)=ζ(p,k0+k1),





  
    
      
        
          ζ
          ⁡
          
            (
            
              p
              ,
              k
            
            )
          
        
        =
        
          {
          
            
              
                
                  
                    
                      
                        (
                        
                          1
                          +
                          
                            
                              3
                              ⁢
                              k
                            
                            
                              4
                              ⁢
                              π
                              ⁢
                              
                                
                                  
                                  p
                                  
                                
                                3
                              
                            
                          
                        
                        )
                      
                      
                        1
                        /
                        3
                      
                    
                  
                  
                    
                      
                        p
                        ⁢
                        
                          
                        
                        ⁢
                        if
                        ⁢
                        
                          
                        
                        ⁢
                        
                          r
                          ⁡
                          
                            (
                            k
                            )
                          
                        
                      
                      <
                      
                        
                        p
                        
                      
                    
                  
                
                
                  
                    0
                  
                  
                    otherwise
                  
                
              
              ⁢
              
                

              
              ⁢
              
                r
                ⁡
                
                  (
                  k
                  )
                
              
            
            =
            
              
                
                  (
                  
                    
                      max
                      ⁡
                      
                        (
                        
                          
                            -
                            k
                          
                          ,
                          0
                        
                        )
                      
                    
                    ⁢
                    
                      3
                      /
                      4
                    
                    ⁢
                    π
                  
                  )
                
                
                  1
                  /
                  3
                
              
              .
            
          
        
      
    
    
      
        (
        23
        )
      
    
  




This provides a geometric insight: a boundary opposing the flow is akin to an insertion and removal of volume at the boundary proportional to the boundary's opposition to the flow. The discretization of {right arrow over (h)} is stable, but more accurate away from the boundary than near the boundary. To remedy the problem of accuracy, the solution {right arrow over (h)}δΩ may be defined on the boundary. Since {right arrow over (n)}·{right arrow over (h)}δΩ={right arrow over (n)}·({right arrow over (v)}Ωc−{right arrow over (u)}) and {right arrow over (h)}δΩ is aligned with the normal

{right arrow over (h)}δΩ(p)=({right arrow over (n)}·({right arrow over (v)}Ωc(p)−{right arrow over (u)}(p))){right arrow over (n)}.  (24)

In addition, if a point p enters the boundary, the point is pushed out to the nearest position on the surface

{right arrow over (h)}Ω(p)=argminxεδΩ(∥p−x∥).  (25)

Equations (22) and (24)-(25) are assembled to construct the full definition of {right arrow over (h)}, by blending {right arrow over (h)}Ωc and {right arrow over (h)}δΩ with a smoothstep function based on the distance {circumflex over (r)} between the samples on the boundary




  
    
      
        
          
            h
            ->
          
          ⁡
          
            (
            p
            )
          
        
        =
        
          {
          
            
              
                
                  
                    
                      
                        h
                        ->
                      
                      Ω
                    
                    ⁡
                    
                      (
                      p
                      )
                    
                  
                
                
                  
                    
                      if
                      ⁢
                      
                        
                      
                      ⁢
                      p
                    
                    ∈
                    Ω
                  
                
              
              
                
                  
                    mix
                    ⁡
                    
                      (
                      
                        
                          
                            
                              h
                              ->
                            
                            δΩ
                          
                          ⁡
                          
                            (
                            p
                            )
                          
                        
                        ,
                        
                          
                            
                              h
                              ->
                            
                            
                              Ω
                              c
                            
                          
                          ⁡
                          
                            (
                            p
                            )
                          
                        
                      
                      )
                    
                  
                
                
                  otherwise
                
              
            
            ,
          
        
      
    
    
      
        (
        26
        )
      
    
  




where mix({right arrow over (a)},{right arrow over (b)})={right arrow over (a)}+smoothstep





  
    
      (
      
        d
        
          r
          ^
        
      
      )
    
    ⁢
    
      (
      
        
          b
          ->
        
        -
        
          a
          ->
        
      
      )
    
  
  ,




given the distance d from p to δΩ.

FIG. 6 illustrates an example of vorticle shedding, according to an embodiment. As shown in panel A, a constant flow moves around a static pole 610, and the surface of the pole 610 sheds vorticles. In general, an object that accelerates in a flow will stick to the flow and shed vorticles into the flow. Panel B shows that a slice of the vorticity induced by the vorticles reveals the emergent behavior of a von Kármán vortex street.
When the position p is at the boundary of a solid object, the term




  
    
      ∇
      
        log
        ⁡
        
          (
          ρ
          )
        
      
    
    ×
    
      (
      
        
          F
          ->
        
        -
        
          
            d
            ⁢
            
              v
              ->
            
          
          dt
        
      
      )
    
  
  +
  
    ∇
    
      ×
      
        F
        ->
      
    
  




in equation (2) measures the change of vorticity at the moving object's boundary. This vorticity spreads into the flow by diffusion proportional to viscosity coefficient ν introduced above. It can be shown that the surface vorticity that satisfies the boundary condition discussed above is





  
    (
    
      
        f
        ->
      
      -
      
        e
        ->
      
      -
      
        
          d
          ⁢
          
            v
            ->
          
        
        dt
      
    
    )
  
  ×
  
    
      n
      ->
    
    .
  




The vorticity shedding is then the solution to a differential equation with boundary condition





  
    
      
        {
        
          
            
              
                
                  
                    
                      d
                      ⁢
                      
                        ω
                        ->
                      
                    
                    dt
                  
                  =
                  
                    υ
                    ⁢
                    
                      
                        ∇
                        2
                      
                      ⁢
                      
                        ω
                        ->
                      
                    
                  
                
              
            
            
              
                
                  
                    ω
                    ->
                  
                  =
                  
                    
                      
                        D
                        t
                        
                        
                          
                            p
                            ∈
                            Ω
                          
                          
                      
                      (
                      
                        
                          f
                          ->
                        
                        -
                        
                          e
                          ->
                        
                        -
                        
                          
                            d
                            ⁢
                            
                              v
                              ->
                            
                          
                          dt
                        
                      
                      )
                    
                    ×
                    
                      n
                      ->
                    
                  
                
              
            
          
          .
        
      
    
    
      
        (
        27
        )
      
    
  




Equation (27) can be solved by shedding vorticles. The surface may be divided into n panels of area ai and centroid xi, and emit per panel a vorticle that approximates the heat kernel





  
    
      
        
          
            
              w
              ->
            
            i
          
          =
          
            
              a
              i
            
            ⁢
            
              
                r
                
                  5
                  /
                  2
                
              
              
                8
                ⁢
                π
                ⁢
                
                  
                
                ⁢
                
                  D
                  t
                
                ⁢
                υ
              
            
            ⁢
            
              (
              
                
                  f
                  ->
                
                -
                
                  e
                  ->
                
                -
                
                  
                    d
                    ⁢
                    
                      v
                      ->
                    
                  
                  dt
                
              
              )
            
            ×
            
              n
              ->
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            r
            i
          
          =
          
            
              2
            
            ⁢
            
              
                
                  
                    D
                    t
                  
                  ⁢
                  υ
                
              
              .
            
          
        
      
    
    
      
        (
        28
        )
      
    
  








  
  
    
      (
      
        
          f
          ->
        
        -
        
          e
          ->
        
        -
        
          
            d
            ⁢
            
              v
              ->
            
          
          dt
        
      
      )
    
    ×
    
      n
      ->
    
  
  




can be used as a probability distribution function to create samples at the locations that most affect the flow. Note that {right arrow over (f)} is the surface acceleration, as opposed to the velocity. To compute the acceleration, the equation (4) at the previous time may be stored on the surface, and acceleration may be computed as





  
    
      d
      ⁢
      
        v
        ->
      
    
    dt
  
  ≃
  
    
      
        
          
            v
            ->
          
          ⁡
          
            (
            t
            )
          
        
        -
        
          
            v
            ->
          
          ⁡
          
            (
            
              t
              -
              
                D
                t
              
            
            )
          
        
      
      
        D
        t
      
    
    .
  




As shown in FIG. 6, this produces the expected vorticle shedding behavior.

FIG. 7 illustrates a method 700 for rendering a gas, according to an embodiment. The steps of the method 700 may be repeated for a number of time steps to simulate the gas, but only a single time step is described with respect to FIG. 7 for conciseness. It is assumed that, prior to the gas being rendered, a user has set up the rendering simulation by defining, e.g., object(s) in a scene, colliders, gravity, gust(s) of wind, and emitters of density, among other things. In one embodiment, three types of particles may be defined by the user: vorticles for rotations, density particles for buoyancy, and visual particles that are actually rendered to an image and controlled by the vorticles, density particles, and object boundaries during simulation of the gas. The vorticles may each have an axis around which rotation is happening, a strength of the rotation, and a size representing the footprint of the vorticle in space; the density particles may have mass and work in connection with gravity; and the visual particles may have density. In such a case, a user may place vorticles if the user wishes to create a wind pushing one way or another, the user may place density particles in a scene if the user wishes the gas to float or sink, and the user may place visual particles to be able to see the simulation result. In addition, the user may define deformable boundaries of objects in the scene which are sampled as colliders during the simulation.
In another embodiment, the number of samples of the colliders, shedding, sources, buoyancy, and density may be controlled independently, and users are able control a flow by modifying existing vorticles with external forces {right arrow over (e)} or via the harmonic field {right arrow over (h)}, or by creating new vorticles. For example, a turbulent field may be created by scattering vorticles with random parameters, a gust of wind may be created by placing vorticles aligned with the tangent of a ring perpendicular to the direction of the desired wind, an invisible collider may be moved to warp space, and the amount of shedding of vorticles and buoyancy can be artificially dialed up or down. Additional dials that may be tunable per vorticle in some embodiments include overshoot, spin, and artificial damping. Overshoot and undershoot refer to, for advection of visible particles, the scaling higher or lower of velocity to create drag or extra swirliness. Although physically implausible, this can help create styles. Spin refers to the axis of vorticles being aligned with vector fields to modify the fluid motion globally. Artificial damping refers to strength of vorticles being artificially reduced using, e.g., a damping coefficient that is stored per vorticle.
At step 710, the simulation application scatters point samples on boundaries of objects using the probability distribution discussed above with respect to FIG. 6. As discussed, the surface of objects are divided into areas that emit per area a monopole that approximates a surface pixel, and the probability distribution




  
  
    
      (
      
        
          f
          ->
        
        -
        
          e
          ->
        
        -
        
          
            d
            ⁢
            
              v
              ->
            
          
          dt
        
      
      )
    
    ×
    
      n
      ->
    
  
  




may be used to create samples at locations that most affect the flow in one embodiment.

At step 720, the simulation application creates vorticles via one or a combination of vortex shedding, buoyancy, and emitting vorticles defined by a user. In one embodiment, vortex shedding may be defined by equation (28), discussed above. For example, an object accelerating through a flow may shed vorticles. New vorticles may also be created from buoyancy, as defined by equation (19), discussed above. In addition, new vorticles may be emitted as defined by the user. For example, the user may scatter a uniform distribution of random vorticles to produce an initial condition, and vorticles may be emitted on a circle with tangential strength, producing a source of wind.
At step 730, the simulation application computes a harmonic field which makes flow of the gas an ideal nonviscous flow. In one embodiment, the harmonic field {right arrow over (h)} induced by colliders on visual particles, density particles, and vorticles may be computed using equation (26), discussed above.
At step 740, the simulation application computes a velocity field that is the sum of the harmonic field and the field induced by vorticles on boundary points placed on one or more of the object(s) in the scene. In one embodiment, the velocity {right arrow over (u)} induced by vorticles on visual particles that are actually seen by the user, density particles, and vorticles may be computed using equation (4), discussed above.
Then, at step 750, the simulation application advects visual particles, density particles, and vorticles of the gas using the velocity field. In general, the advecting process stretches or squashes (a squash being a reverse stretch) vorticles, thereby modifying the shape of the vorticles' footprints as well as potentially changing the position and axis of rotation of the vorticles. As discussed, stretched vorticles may further be unstretched by measuring a new footprint for the vorticle such that a new vorticle that is round has the same enstrophy and mean energy in a next image frame.
In one embodiment, the simulation application may apply the displacement Dt({right arrow over (u)}+{right arrow over (h)}) to visual particles, density particles, and vorticles during the advecting process. Several integration schemes may be used to advect particles along an induced velocity field. A simple method which is stable for large steps relies on circular path lines of individual vorticles and replaces equation (6a), above, with




  
    
      
        
          
            
              k
              ->
            
            w
          
          =
          
            
              D
              t
            
            ⁢
            
              
                φ
                i
              
              ⁡
              
                (
                
                  p
                  -
                  
                    x
                    i
                  
                
                )
              
            
            ⁢
            
              
                w
                ->
              
              i
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              k
              ->
            
            x
          
          =
          
            
              
                k
                ->
              
              w
            
            ×
            
              (
              
                p
                -
                
                  x
                  i
                
              
              )
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              
                v
                ->
              
              i
            
            ⁡
            
              (
              p
              )
            
          
          =
          
            
              1
              
                D
                t
              
            
            ⁢
            
              
                (
                
                  
                    
                      
                        1
                        -
                        
                          cos
                          (
                          
                            
                            
                              
                                k
                                ->
                              
                              w
                            
                            
                          
                          )
                        
                      
                      
                        
                          k
                          ->
                        
                        w
                        2
                      
                    
                    ⁢
                    
                      
                        k
                        ->
                      
                      w
                    
                    ×
                    
                      
                        k
                        ->
                      
                      x
                    
                  
                  +
                  
                    
                      
                        sin
                        (
                        
                          
                          
                            
                              k
                              ->
                            
                            w
                          
                          
                        
                        )
                      
                      
                        
                        
                          
                            k
                            ->
                          
                          w
                        
                        
                      
                    
                    ⁢
                    
                      
                        k
                        ->
                      
                      x
                    
                  
                
                )
              
              .
            
          
        
      
    
    
      
        (
        29
        )
      
    
  




At step 760, the simulation application fuses vorticles, as appropriate. Fusing vorticles that are sufficiently similar to each other and sufficiently close in distance may improve computational efficiency. The fusing may be performed in a hierarchical manner, as is known to one of skill in the art. In one embodiment, vorticles may be considered similar enough when ∥pi−pj∥ and |ri−rj| are smaller than a distance threshold ε which is user-controllable. Also, the velocity induced by a group of far away vorticles can be obtained by fusing the vorticles. The fused vorticle is given by the following formula




  
    
      
        
          x
          =
          
            
              ∑
              
                
              
              ⁢
              
                x
                i
              
            
            n
          
        
        ⁢
        
          

        
        ⁢
        
          r
          =
          
            
              (
              
                
                  
                    ∑
                    i
                  
                  ⁢
                  
                    r
                    i
                    
                      -
                      
                        5
                        2
                      
                    
                  
                
                
                  
                    ∑
                    i
                  
                  ⁢
                  
                    
                      r
                      i
                    
                  
                
              
              )
            
            
              
                -
                1
              
              /
              3
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              w
              ->
            
            =
            
              
                
                  ∑
                  i
                
                ⁢
                
                  
                    
                      r
                      i
                    
                  
                  ⁢
                  
                    
                      w
                      ->
                    
                    i
                  
                
              
              
                r
              
            
          
          ,
        
      
    
    
      
        (
        30
        )
      
    
  




where n is the number of vorticles in the cell and i is the vorticle index. The above is asymptotic to the sum of vorticles and equal to the sum when the vorticles have the same radius.

Then at step 770, the simulation application attenuates and deletes vorticles, as appropriate. This step includes viscosity. Similar to fusing vorticles, attenuating and deleting vorticles may improve computational efficiency. The attenuation of vorticles may be based on the diffusion of vorticles leaking vorticity to regions which contain no vorticity, and the rate of attenuation may be user-controllable. Attenuated vorticles may eventually cease to spin and be deleted. The vorticles that are deleted may include vorticles far from visual particles, vorticles outside of a view frustrum, vorticles having low strength, or some combination of these.
In one embodiment, a vorticle cutoff proportional to vorticle size ri may be used. Doing so reduces the algorithmic complexity of the method 700 to O(N) when neighbor cell lists are used. This accelerates the nearest vorticle search while preserving an incompressible flow since the cutoff is constant along the streamlines of rotation. Since vorticles are band limited, the vorticles may further be split into groups of similar radii, and their displacements evaluated in sparse grids with cell size proportional to the cutoff. In a particular embodiment, the vorticle cutoff may be introduced on both the falloff and its gradient in a manner that preserves smoothness. Let the vorticle's cutoff distance be defined as mri. Using the following values




  
    
      
        
          
            k
            0
          
          =
          
            4
            ⁢
            
              (
              
                1
                +
                
                  2
                  ⁢
                  
                    m
                    2
                  
                
              
              )
            
            ⁢
            
              r
              i
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            k
            1
          
          =
          
            2
            +
            
              m
              2
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            k
            2
          
          =
          
            
              k
              1
              2
            
            ⁢
            
              
                k
                1
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            a
            0
          
          =
          
            
              r
              i
            
            
              
                r
                i
              
              -
              
                
                  2
                
                ⁢
                
                  
                    κ
                    0
                  
                  /
                  
                    κ
                    2
                  
                
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            a
            1
          
          =
          
            
              2
            
            ⁢
            
              
                
                  κ
                  0
                
                -
                
                  6
                  ⁢
                  m
                  ⁢
                  
                    
                    
                      p
                      -
                      
                        x
                        i
                      
                    
                    
                  
                
              
              
                
                  κ
                  2
                
                ⁢
                
                  
                    r
                    i
                  
                
                ⁢
                
                  r
                  i
                  3
                
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            
              a
              3
            
            =
            
              
                6
                ⁢
                
                  2
                
              
              
                
                  κ
                  2
                
                ⁢
                
                  
                    r
                    i
                  
                
                ⁢
                
                  r
                  i
                  4
                
              
            
          
          ,
        
      
    
    
      
        (
        31
        )
      
    
  




the remapped falloff and gradient are

{tilde over (φ)}i=a0(φi−a1)

∇{tilde over (φ)}i=∇φi+a3(p−xi).  (32)

This vorticle cutoff provides an adjustable tradeoff between the falloff's physically based properties and spatially localized computations, with defaults set to, e.g., 6ri and ri/2.

In another embodiment, vorticles may be assigned an artificial decay rate, triggered by an event controlled by a varying expression. As a result, the vorticles may have limited lifespan. In a further embodiment, band-limiting may be employed in which, as stretching deforms vorticles outside of the range (rmin, rmax), the vorticle's strength {right arrow over (w)}j is reduced instead of scaling the vorticle's radius ri. For shrinking small vorticles, this models the fluid's viscous behavior at small scales, and for expanding large vorticles this reduces their contribution to velocity artificially. In an additional embodiment, vorticle radii may be paged. Splitting the vorticles in groups of similar radii has been seen to lead to more efficient use of acceleration structure for distance queries, and a logarithmic scale may be used to split vorticles in such groups. In yet another embodiment, velocities may be cached. When the point density is particularly high within a region of space, velocity may be evaluated at the vertices of a lattice and interpolated in-between.
At step 780, the simulation application renders the visual particles in an image frame, which is the output viewable by a user.
FIG. 8 depicts a block diagram of a system 800 in which an aspect of this disclosure may be implemented. As shown, the system 800 includes, without limitation, a central processing unit (CPU) 810, a network interface 830, an interconnect 815, a memory 860 and storage 820. The system 800 may also include an I/O device interface 840 connecting I/O devices 850 (e.g., keyboard, display and mouse devices) to the system 800.
The CPU 810 retrieves and executes programming instructions stored in the memory 860. Similarly, the CPU 810 stores and retrieves application data residing in the memory 860. The interconnect 815 facilitates transmission, such as of programming instructions and application data, between the CPU 810, I/O device interface 840, storage 820, network interface 830, and memory 860. CPU 810 is included to be representative of a single CPU, multiple CPUs, a single CPU having multiple processing cores, one or more graphics processor units (GPUs), and the like, or some combination of these. And the memory 860 is generally included to be representative of a random access memory. The storage 820 may be a disk drive storage device. Although shown as a single unit, the storage 820 may be a combination of fixed and/or removable storage devices, such as fixed disc drives, removable memory cards or optical storage, network attached storage (NAS), or a storage area-network (SAN). Further, system 800 is included to be representative of a physical computing system as well as virtual machine instances hosted on a set of underlying physical computing systems. Further still, although shown as a single computing system, one of ordinary skill in the art will recognized that the components of the system 800 shown in FIG. 8 may be distributed across multiple computing systems connected by a data communications network.
As shown, the memory 860 includes an operating system 861 and a simulation application 862. For example, the operating system may be Microsoft Windows®. The simulation application 862 is configured to simulate a gas. In one embodiment, the simulation application 862 may, for a number of time steps: scatter point samples on boundaries of objects; create vorticles via one or a combination of vortex shedding, buoyancy, and emitting vorticles defined by a user; compute a harmonic field which makes flow of the gas an ideal nonviscous flow; compute a velocity field that is the sum of the harmonic field and the field induced by vorticles on boundary points placed on one or more of the object(s) in the scene; advect visual particles, density particles, and the vorticles using the velocity field; fuse vorticles, attenuate vorticles, and delete vorticles, as appropriate; and render the visual particles in an image, as discussed above with respect to FIG. 7. Rendered images may then be stored in the storage 820.
Advantageously, techniques disclosed herein permit gases to be simulated using vorticles, providing a full set of features expected from a gas simulation while using only vorticles and monopoles. In contrast to traditional voxel grid based simulation, techniques disclosed herein employ a Lagrangian vorticle-based simulation which uses point integrals and is more scalable than traditional techniques that required computing matrix inverses. The vorticles are defined in relation to the Navier-Stokes equation. The simulation of gases has no divergence by construction and avoids solving pressure completely. The simulation is also gridless and can span domains of arbitrary size and resolution. The sampling resolutions of density, dynamics, boundary condition and sources are decoupled from each other, which permits many options for adaptive sampling strategies. In addition, techniques disclosed herein advect vorticles that carry a volume of vorticity, rather than filtering a point vorticity. Doing so leads to stable stretching. Further stability is achieved by integrating streamlines instead of velocity. The model for boundary pressure disclosed herein does not require solving a linear system, and the model disclosed herein for buoyancy which plays a role in gas motion is capable of producing lively smokes and pyroclastic effects.
Reference is made herein to embodiments of the invention. However, it should be understood that the invention is not limited to specific described embodiments. Instead, any combination of the described features and elements, whether related to different embodiments or not, is contemplated to implement and practice the invention. Furthermore, although embodiments of the invention may achieve advantages over other possible solutions and/or over the prior art, whether or not a particular advantage is achieved by a given embodiment is not limiting of the invention. Thus, the aspects, features, embodiments and advantages are merely illustrative and are not considered elements or limitations of the appended claims except where explicitly recited in a claim(s). Likewise, reference to “the invention” shall not be construed as a generalization of any inventive subject matter disclosed herein and shall not be considered to be an element or limitation of the appended claims except where explicitly recited in a claim(s).
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, aspects of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the present invention may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon.
Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks
While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.

## Claims

1. A method for rendering animation frames depicting gaseous matter, comprising, for each of a plurality of time steps:
creating vorticles via at least one of vortex shedding, buoyancy, and emitting vorticles;
determining a harmonic field which makes flow of the gaseous matter an ideal nonviscous flow;
determining a velocity field which is a sum of the harmonic field and a field induced by one or more of the vorticles on boundary points placed on one or more moving objects;
advecting visual particles, density particles, and the vorticles using the velocity field; and
rendering the visual particles in an image frame.

2. The method of claim 1, wherein a basis of the vorticles permits stable stretching of the vorticles.

3. The method of claim 2, wherein stretching and squashing of the vorticles is performed in a manner that maintains constant enstrophy and mean energy.

4. The method of claim 1, wherein the velocity field is determined using a dynamic model that permits user control of at least one of external forces, buoyancy, rigid and deformable boundaries, and viscosity.

5. The method of claim 4, wherein sampling resolutions for density, dynamics, boundary conditions, and sources in the dynamic model are decoupled from each other.

6. The method of claim 4, wherein the dynamic model includes a boundary pressure model in which a boundary of the gaseous matter is imposed by embedding into the gaseous matter a surface boundary and setting boundary conditions based on velocity of the surface boundary and a Green's function of the Laplacian.

7. The method of claim 4, wherein the dynamic model includes a viscosity term that reduces strength of the vorticles based on a measure of isolation of the vorticles.

8. The method of claim 4, wherein the dynamic model includes a buoyancy term that models density particles in the gaseous matter emitting rings of vorticles with strengths corresponding to masses of the density particles.

9. The method of claim 1, wherein the vortex shedding includes emitting, for each of one or more of a plurality of panels into which surfaces of the objects are divided, a respective vorticle that approximates a heat kernel, based on a probability distribution function.

10. The method of claim 1, further comprising, for one or more of the time steps, at least one of:
fusing two or more of the vorticles based on distance and similarity criteria;
deleting one or more of the vorticles which are far from the visual particles, outside a view frustrum, or whose strength is less than a threshold value; and
attenuating one or more of the vorticles.

11. A non-transitory computer-readable storage medium storing a program, which, when executed by a processor performs operations for rendering animation frames depicting gaseous matter, the operations comprising, for each of a plurality of time steps:
creating vorticles via at least one of vortex shedding, buoyancy, and emitting vorticles;
determining a harmonic field which makes flow of the gaseous matter an ideal nonviscous flow;
determining a velocity field which is a sum of the harmonic field and a field induced by one or more of the vorticles on boundary points placed on one or more moving objects;
advecting visual particles, density particles, and the vorticles using the velocity field; and
rendering the visual particles in an image frame.

12. The computer-readable storage medium of claim 11, wherein a basis of the vorticles permits stable stretching of the vorticles.

13. The computer-readable storage medium of claim 12, wherein stretching and squashing of the vorticles is performed in a manner that maintains constant enstrophy and mean energy.

14. The computer-readable storage medium of claim 11, wherein the velocity field is determined using a dynamic model that permits user control of at least one of external forces, buoyancy, rigid and deformable boundaries, and viscosity.

15. The computer-readable storage medium of claim 14, wherein sampling resolutions for density, dynamics, boundary conditions, and sources in the dynamic model are decoupled from each other.

16. The computer-readable storage medium of claim 14, wherein the dynamic model includes a boundary pressure model in which a boundary of the gaseous matter is imposed by embedding into the gaseous matter a surface boundary and setting boundary conditions based on velocity of the surface boundary and a Green's function of the Laplacian.

17. The computer-readable storage medium of claim 14, wherein the dynamic model includes a viscosity term that reduces strength of the vorticles based on a measure of isolation of the vorticles.

18. The computer-readable storage medium of claim 14, wherein the dynamic model includes a buoyancy term that models density particles in the gaseous matter emitting rings of vorticles with strengths corresponding to masses of the density particles.

19. The computer-readable storage medium of claim 11, wherein the vortex shedding includes emitting, for each of one or more of a plurality of panels into which surfaces of the objects are divided, a respective vorticle that approximates a heat kernel, based on a probability distribution function.

20. The computer-readable storage medium of claim 11, further comprising, for one or more of the time steps, at least one of:
fusing two or more of the vorticles based on distance and similarity criteria;
deleting one or more of the vorticles which are far from the visual particles, outside a view frustrum, or whose strength is less than a threshold value; and
attenuating one or more of the vorticles.

21. A system, comprising:
a processor; and
a memory, wherein the memory includes an application program configured to perform operations for rendering animation frames depicting gaseous matter, the operations comprising, for each of a plurality of time steps:
creating vorticles via at least one of vortex shedding, buoyancy, and emitting vorticles,
determining a harmonic field which makes flow of the gaseous matter an ideal nonviscous flow,
determining a velocity field which is a sum of the harmonic field and a field induced by one or more of the vorticles on boundary points placed on one or more moving objects,
advecting visual particles, density particles, and the vorticles using the velocity field, and
rendering the visual particles in an image frame.