FLOW - Usage in VR Funhouse

Also See the Flow documentation for more information.

Set Up a FLOW Asset in UE4

  1. Create a new Flow Grid Asset (right click in Content Browser: Physics: Flow Grid Asset)

  2. Drag this new asset into the level, place it in the middle

  3. Make a new blueprint actor

    1. Add New Blueprint class
  4. Edit blueprint actor, add a Sphere component

    1. Must be uniform scale
    2. Set Collision Preset to Custom
    3. Set object type to something besides Flow
    4. Set Flow channel to Overlap
  5. Add a FlowEmitter component to blueprint actor

  6. Drag the blueprint class actor into the level, you should see your sphere

  7. Run PIE, you should see flame coming from your sphere

  8. flowvis will show some handy visualization of the grid and cells

Grid Tuning

The parameters in the Flow grid asset control the fundamental behavior of the simulation. Grid cell size determines the resolution. Higher resolution means more detail, but also means more cells must be simulated for the same volume. For performance tuning, keep in mind volume is the cell size cubed (grid cell size ^ 3). This means small changes to the grid cell size will have a proportionally larger impact on performance.

  • The combination of grid cell size and virtual grid dimension determines the extents of the grid address space. This is visualized in the editor by clicking on the flow grid actor. The flowvis command will also visualize the grid extents.
  • Memory limit scale controls the relative memory usage with respect to the default value. For higher cost effects, the default limit can be increased. This is likely necessary if the flowvis visualization indicates that blocks expected to allocate are unable. This is often observed as a cube shaped clipping effect.
  • Simulation rate controls the grid update rate. Fixed time stepping is used for consistent behavior. The simulation rate can be increased to improve grid response time, at the cost of performance. Multi-adapter enabled allows the grid to simulate on secondary GPUs when available, offering a potential performance increase. (currently win10 only)
  • The velocity, density, temperature, and fuel weights and thresholds control what blocks the grid allocates beyond what emitters allocate. The default settings are targeted for flame with limited smoke, so only the temperature weight is nonzero. The temperature threshold needs to be greater than zero to be effective at deallocation. The threshold should be aligned with the color map alpha, so that the effect is visually faded before deallocation.

Rendering

  • The Flow grid asset includes parameters that control rendering. The color map describes color and transparency at a function of temperature. Density values combines with the color map to drive final opacity. Rendering alpha scale gives a convenient global opacity scale.
  • The asset parameters also includes a rendering mode to get useful visualizations, such as a density visualization (render mode 1) and a velocity field visualization (render mode 5).

Emitter Tuning

The emitter velocity, density, temperature, and fuel settings are all target values that the user would like grid cells to move towards. The rate at which the emitter moves a grid cell towards the target value is controlled by the product of the couple rate and per channel masks. Higher couple rates move towards the target values in a shorter amount of time. This property is useful for moving objects. Lower couple rates can be very useful for stationary objects, since the weaker influence on the simulation allows simulation to happen naturally instead the emitter.

  • Due to the couple rate properties, in practice, good results are achieved by increasing couple rate via UE4 blueprints as function of velocity. Doing this in blueprints adds a bit more authoring, but allows the user to tune behavior. It resolves the ambiguity of whether or not an emitter should emit more or less when moving.
  • An important concept with emitters is understanding what setting, for example, temperature to zero means. In the temperature case, if the couple rate is nonzero and temperature mask is nonzero, then the emitter is configured to drive temperature in the grid cells to zero. This may not be the intended behavior. If the intention was to not modify the temperature, then the temperature mask should be set to zero. Alternatively, the couple rate could be set to zero, but this has the effect of disabling the emitter.
  • Emitters also influence grid block allocation. Allocation scale controls how much of the emitter bounding box should force allocate grid blocks. An allocation scale of 0.0 disables emitter allocation, which is useful for collision shapes, where the grid only needs to be active when visible fluid is present. A nonzero allocation scale on at least one emitter is required to get any activity in the grid, since grid self allocation uses an active block to control the active block’s own allocation and the allocation of neighboring blocks.
  • Multiple frames are required to make a given block resident/active. This creates a need to predict allocation needs several frames into the future to avoid possible artifacts. Increasing allocation scale is a non-directional option to achieve this. Allocation predict is the directional option. It allocates in the direction of the emitter velocity, making it ideal for prediction along trajectories.