SpeedSix.Fluids (Discreet Box99)
PURPOSE
Simulates 2 dimensional fluid flow. The flow model is physically based and many different results can be obtained by setting appropriate parameters. The flow is applied to an input image, which is considered to be made of a fluid with certain properties. Although physically based, several approximations are made to obtain performance, stability and simplicity. The motion of the fluid is caused by various forces which can be applied. Given these forces, the code calculates the velocity of the fluid at every point on a grid (the CFD grid). This is done by solving the Navier-Stokes equations for fluid flow - albeit not very accurately. As a result, pretty much all the motions characteristic of flowing fluids (e.g. swirling motion, wakes from flows around solid objects, etc.) will appear in the result. The CFD grid on which the velocity field is calculated is typically 128 x 128, which gives a good trade off between detail in the flow, compute time and numerical algorithm issues. Once a physically reasonable velocity field has been found, the input image is moved along by integrating the velocities encountered by an image location over a one frame time step to arrive at a new position for that location. The "image location" can be either a point on a subsampled version of the image at the resolution of the CFD grid, or a texture coordinate - i.e. texture coordinates are "flowed" rather than (a subsampled version of) the image itself. Using the "texture method" preserves the resolution of the input image, although it is less accurate in other ways. Using CFD grids with the same resolution as the image is impractical for typical image sizes for reasons of time and numerical issues. The CFD calculations can be done by one of two methods: "direct" or "fourier". The "direct" method permits non-periodic velocity fields (i.e. ones that don't wrap around left-to-right and top-to-bottom), stable solid objects in the flow, and (oddly) the ability to wrap or not at the edges when using texture coordinates. However, it uses an iterative algorithm to solve critical parts of the CFD equations, so the time per frame is not fixed (and convergence is not guaranteed, although at 128 x 128, it will happen). The "fourier" method will always produce periodic velocity fields and periodic results in "direct" mode, although it *cannot* produce periodic results in "texture" mode. It is a fixed time per frame algorithm, however, has no convergence issues, and is more "accurate" than the "direct" solver.
INPUT CLIPS
1: Flow Clip
: Clip to apply flow to. The first image in the clip is used as the thing to flow - or the first encountered after the "Restart" button is pressed. Other frames in the clip may be used as "sources" using the "Self Source" option, but are otherwise ignored.
Example : Aux Clip
2: Aux Clip
: A second input, which can be used for several purposes - e.g. to supply relative density information for buoyancy forces.
Example : Sources Clip
3: Sources Clip
: Sources clip. Contents may be added to the flow at each frame.
Example : Sinks Clip
4: Sinks Clip
: Sinks clip. Contents may be subtracted from the flow at each frame.
Example : Barrier Clip
5: Barrier Clip
: Barrier clip. Lets you specify where there are solid objects in the flow. White denotes the presence of an object. Please note that this information is (must be) binary - at a given point on the CFD grid, there is either part of a solid object or there isn't. This will inevitably give "jimpy" edges around solid objects. Increasing the CFD grid resolution to counter this is *not* recommended as the compute time and numerical issues for the "direct" solver makes this less than ideal. A better plan is to composite full resolution versions of the solid objects over the result.
Fluids CONTROL PAGE
Viscosity (Number Min: 0.000001, Max: 100.0, Default: 0.01)
Viscosity of the fluid. The higher the viscosity, the more reluctant the fluid is to flow and the quicker any flow comes to a halt in the absence of applied forces.
ViscMax (Number Min: 0.000001, Max: 100.0, Default: 0.01)
Maximum viscosity of the fluid.
Diffusion (Number Min: 0.0, Max: 1.0, Default: 0.0)
Diffusion constant for the fluid. Diffusion controls the rate at which a blob of "stuff" spreads out as time passes.
Dissipation (Number Min: 0.0, Max: 1.0, Default: 0.0)
Dissipation constant for the fluid. Dissipation controls the rate at which a blob of "stuff" disappears as time passes. "Stuff" is not necessarily conserved.
Grid Size (List Box Options: 64 | 128 | 256 | 512, Default: 128)
Size of the CFD grid. 128 is highly recommended. Higher resolutions will give finer fluid flow detail, but with considerable time penalties and potential numerical problems.
CFD Solver (List Box Options: Direct | Fourier, Default: Direct)
Method used to solve the CFD equations for the velocity field. Direct is the most flexible method. Fourier always results in periodic velocity fields, but is fast, constant time and has no potential numerical issues.
Image Mode (List Box Options: Texture | Grid, Default: Texture)
How the image is made to flow. Texture applies the flow to texture coordinates in the CFD grid, and uses those to access the image. This preserves the resolution of the image, although it may lose some subtle aspects of the flow behaviour. Grid puts the image into the CFD grid - at the resolution of the CFD grid - and solves for the flow directly. CFD grid sizes that would preserve the resolution of typical images are not practical, unfortunately.
Wrap Mode (List Box Options: None | Horizontal | Vertical | Both, Default: None)
How the flow should wrap around at the edges. The full set of options is only available for the "Direct" solver. In "Texture" mode, the "Fourier" solver cannot wrap. However, for theoretically correct results, "Warp Both" is most appropriate for the "Fourier" solver in "Grid" mode.
Free Edges (Checkbox Default: Off)
Turn off the correct "boundary conditions" for the CFD solver at the edges of the CFD grid. Although doing this is "wrong" - there needs to be stable boundary conditions to get a fully stable solution for the velocity field - you can get interesting "coagulating" and "dissolving" effects around internal barriers with this off. It is also the only way to have the image flow at the edges of the grid in "Fourier" mode. Strictly, "Fourier" mode is incompatible with internal barriers.
AdjustColoursOnly (Checkbox Default: Off)
Adjust only colours. Do not advance the timestep.
PreMultiplyForeground (Checkbox Default: Off)
Have the colours in the foreground fire premultiplied by the fire alpha (density) before compositing.
VariableVisc (Checkbox Default: Off)
Try making viscosity dependent on the local temperature
Use Barriers (Checkbox Default: Off)
Use the barrier image to define solid objects in the flow around which the image should flow. White denotes the presence of an object. Use of the "Direct" solver with "Free Edges" off is recommended. As explained, the solid objects are there (or not) at the resolution of the CFD grid. It is strongly recommended that to get anti-aliased edges for solid objects, images of those objects are composited over the flow result image. Increasing teh CFD grid size is not recommended as a solution to "jimpy" edges.
Buoyancy Mode (List Box Options: None | Input Luma | Aux Luma, Default: None)
Whether to calculate internal buoyancy forces, and, if so, how. "Input Luma" will use the luminance of the input image to calculate the relative density of the fluid. Whether the fluid get denser or less dense with increasing luminance is controlled by the "Density Scale" control. "Aux Luma" uses the luminance of the "Aux" image instead. In this case, the "Aux" image is "flowed" internally by the solver.
Density Scale (Number Min: -1.0, Max: 1.0, Default: 0.0)
How to use luminance to derive density for finding buoyancy forces. Black represents a uniform density. If "Density Scale" is positive, lighter things are more dense and so will tend to sink. If negative, lighter things are less dense and so will tend to rise. Gravity is always present, and always acts directly down.
Source Mode (List Box Options: No Source | Use Source | Self Source, Default: No Source)
Which image to use (if any) to define "sources". Sources in CFD are additional fluids being poured into the flow. They can be very important, because - without wrapping - the flowing "stuff" will tend to flow out of the image, so after a while it will all be gone unless more "stuff" is added. "No Source" doesn't use any sources. "Use Source" uses the "Source" image, and "Self Source" uses the input clip itself as the source.
Source Strength (Number Min: -1.0, Max: 1.0, Default: 0.0)
How much of any source image gets poured into the flow at each frame.
Detail (Number Min: 1.0, Max: 100.0, Default: 50.0)
Texturing detail.
MinDetail (Number Min: 1.0, Max: 100.0, Default: 1.0)
Texturing detail.
StreamBias (Number Min: 0.0, Max: 1.0, Default: 1.0)
Streamline integration bias.
Sink Mode (List Box Options: No Sink | Use Sink | Self Sink, Default: No Sink)
Which image to use (if any) to define "sinks". Sinks in CFD are where the flowing fluid pours out the world and vanishes from consideration. They are generally less important than sources. A scaled fraction of the sink image is subtracted out of the flow at each frame. If you want stuff to vanish down a plughole, you could use a white blob. Note that teh sink doesn't genrate any appropriate forces - you would want add a vortex at the same location to get stuff to swirl down the plughole. "No Sink" doesn't use any sinks. "Use Sink" uses the "Sink" image, and "Self Sink" uses the input clip itself as the sink - which should be pretty weird, usually.
Seething (Number Min: 0.0, Max: 100.0, Default: 3.0)
How much they evolve and thus move from frame to frame. The higher the seething the faster they evolve.
Sink Strength (Number Min: -1.0, Max: 1.0, Default: 0.0)
How much of any sink image gets sucked out of the flow at each frame.
Output (List Box Options: Result | Velocity Mag | Force Mag | Density Mag | Temp Mag | Result CMAP | Temp CMAP | HR T CMAP, Default: Result)
What to output. "Result" is the flowed image - usually the point of using this thing! Velocity Mag displays the magnitude of the velocity field. Red is slow, grren middling and blue fast. Note that each frame is independently normalized to the colour scale, so it isn't possible to see overall trends over a sequence. "Force Mag" does the same thing for the forces being applied.
BoundaryLayer (List Box Options: Slippery | Rough | Sticky, Default: Slippery)
Barrier object surface characteristics.
Restart (Pushbutton)
Restarts the flow. Please note that this is a physical simulation, the whole point of which is that it evolves over time. It isn't possible to independently calculate frames at random, nor is it at all straightforward to calculate frames at random resolutions. No matter how much various compositing systems want to do these things,
Winds CONTROL PAGE
Use Wind1 (Checkbox Default: Off)
Turn on-off the first wind controls. Values set will not be lost when turned off, only ignored.
Wind 1 Start (Position Default: 0.0,0.0)
Position of the start of Wind 1.
TraceSteps (Number Min: 5, Max: 50, Default: 5)
Change the atmosphere pattern.
Use Wind2 (Checkbox Default: Off)
Turn on-off the second wind controls. Values set will not be lost when turned off, only ignored.
Wind 2 Start (Position Default: 0.6 1.0)
Position of the start of Wind 2.
Use Wind3 (Checkbox Default: Off)
Turn on-off the third wind controls. Values set will not be lost when turned off, only ignored.
Wind 3 Start (Position Default: 1.0 0.0)
Position of the start of Wind 3.
Wind 1 End (Position Default: 0.5,0.5)
Position of the end of Wind 1.
Wind 2 End (Position Default: 0.4,0.5)
Position of the end of Wind 2.
Wind 3 End (Position Default: 0.5,0.5)
Position of the end of Wind 3.
Wind 1 Strength (Number Min: 0.0, Max: 1.0, Default: 0.0)
The strength of Wind 1.
Wind 1 Tight (Number Min: 0.0, Max: 200.0, Default: 1.0)
The directional tightness of Wind 1.
Wind 2 Strength (Number Min: 0.0, Max: 1.0, Default: 0.0)
The strength of Wind 2.
Wind 2 Tight (Number Min: 0.0, Max: 200.0, Default: 1.0)
The directional tightness of Wind 2.
Wind 3 Strength (Number Min: 0.0, Max: 1.0, Default: 0.0)
The strength of Wind 3.
Wind 3 Tight (Number Min: 0.0, Max: 200.0, Default: 1.0)
The directional tightness of Wind 3.
Wind 1 Local (Checkbox Default: On)
Make Wind 1 local. It will die away over the distance from Start to End.
Wind 2 Local (Checkbox Default: On)
Make Wind 2 local. It will die away over the distance from Start to End.
Wind 3 Local (Checkbox Default: On)
Make Wind 3 local. It will die away over the distance from Start to End.
Vortices CONTROL PAGE
Vortex 1 Center (Position Default: 0.333 0.333)
Position of the center of Vortex 1.
Use Vortex1 (Checkbox Default: Off)
Turn on-off the first vortex controls. Values set will not be lost when turned off, only ignored.
Use Vortex2 (Checkbox Default: Off)
Turn on-off the second vortex controls. Values set will not be lost when turned off, only ignored.
Vortex 2 Center (Position Default: 0.5 0.666)
Position of the center of Vortex 2.
Use Vortex3 (Checkbox Default: Off)
Turn on-off the third vortex controls. Values set will not be lost when turned off, only ignored.
Vortex 3 Center (Position Default: 0.666 0.333)
Position of the center of Vortex 3.
Vortex 1 Radius (Number Min: 0.001, Max: 1.0, Default: 0.1)
The radius of Vortex 1.
Colour (Colour Box Default: black)
First colour.
Colour (Colour Box Default: grey)
First colour.
Colour (Colour Box Default: red)
First colour.
Colour (Colour Box Default: orange)
First colour.
Colour (Colour Box Default: yellow)
First colour.
Colour (Colour Box Default: white)
First colour.
Vortex 2 Radius (Number Min: 0.001, Max: 1.0, Default: 0.1)
The radius of Vortex 2.
Vortex 3 Radius (Number Min: 0.001, Max: 1.0, Default: 0.1)
The radius of Vortex 3.
Vortex 1 Strength (Number Min: -1.0, Max: 1.0, Default: 0.0)
The strength of Vortex 1.
Vortex 2 Strength (Number Min: -1.0, Max: 1.0, Default: 0.0)
The strength of Vortex 2.
Vortex 3 Strength (Number Min: -1.0, Max: 1.0, Default: 0.0)
The strength of Vortex 3.
Grav (Number Min: -1.0, Max: 1.0, Default: 0.0)
Grav.
TStep (Number Min: 0.1, Max: 10.0, Default: 1.0)
Time step.
VCFS (Number Min: 0.0, Max: 1.0, Default: 0.0)
Vorticity confinement force strength.
DenseDown (Number Min: 0.0, Max: 10.0, Default: 0.0625)
Density down force scaling factor.
HeatUp (Number Min: 0.0, Max: 10.0, Default: 0.1)
Hot stuff buoyancy force scaling factor.
TempDiss (Number Min: 0.0, Max: 1.0, Default: 0.0)
Temperature dissipation rate.
TempAdd (Number Min: 0.0, Max: 1.0, Default: 0.0)
Temperature add rate.
DensAdd (Number Min: 0.0, Max: 1.0, Default: 0.0)
Density add rate.
Vlo (Number Min: 0.0, Max: 1.0, Default: 0.0)
Vlo.
Vhi (Number Min: 0.0, Max: 1.0, Default: 0.0)
Vhi.
V1 (Number Min: 0.0, Max: 1.0, Default: 0.0)
V1.
V2 (Number Min: 0.0, Max: 1.0, Default: 0.2)
V2.
V3 (Number Min: 0.0, Max: 1.0, Default: 0.4)
V3.
V4 (Number Min: 0.0, Max: 1.0, Default: 0.6)
V4.
V5 (Number Min: 0.0, Max: 1.0, Default: 0.8)
V5.
V6 (Number Min: 0.0, Max: 1.0, Default: 1.0)
V6.
FractalAmp (Number Min: 0.0, Max: 16.0, Default: 0.1)
Fractal noise amplitude.
AVlo (Number Min: 0.0, Max: 21.0, Default: 0.0)
Vlo.
AVhi (Number Min: 0.0, Max: 21.0, Default: 1.0)
Vhi.
VViscLow (Number Min: 0.0, Max: 21.0, Default: 1.0)
Vhi.
VViscHigh (Number Min: 0.0, Max: 21.0, Default: 1.0)
Vhi.