Fluid Rendering

Flex fluid particles can be rendered with a screen space technique. The surface rendering is configured using Flex Fluid Surface templates. The fluid surface template can then be assigned to emitters to render the corresponding particles with the surface technique. The look of the surface depends on:

  1. Flex Fluid Surface parameters
  2. Emitter properties
  3. Material referenced in Flex Fluid Surface parameters
  4. Flex Container parameters
_images/fluidsurface.jpg

Creating a Flex Fluid Surface

To create a fluid surface template, right-click in the Content Browser, and choose Create Advanced Asset->Physics->FlexFluidSurface.

_images/NewFluidSurface.jpg

Fluid Surface Properties

Give your container an appropriate name, e.g.: FlexFluidSurface, and double click to open it’s property sheet.

_images/fluidsurfacetemplate.jpg

Flex Fluid Surface

  • Smoothing Radius Radius for smoothing the surface. Higher values result in a smoother surface.
  • Max Radial Samples This parameter controls how many neighboring pixels in each direction are taken into account for the screen space smoothing operation. It limits how large the smoothing filter defined through the
  • Smoothing Radiu can become in screen space. Large values can have an impact on performance.
  • Depth Edge Falloff The depth edge falloff controls smoothing across inner silhouettes. If the depth separation between particles exceeds the size of the particles, smoothing should be turned off to avoid blending between foreground and background. The depth edge falloff controls how much smoothing is tuned down based on the depth separation. A value of 0.0 disables all smoothing.
  • Thickness Particle Scale Translucent surfaces look more convincing if the background becomes less visible where the liquid is thicker. The screen space surface technique provides a thickness value to the material used to render the surface to achieve such an effect. The thickness value is computed using an additive blend between the particles rendered as spheres. The size of the spheres is controlled by this parameter.
  • Depth Particle Scale The size of the emitted particles influences the distance of the rendered surface to the particles. Larger particle sizes result in a surface that makes the liquid appear to have more volume. The Depth Particle Scale controls the particle sizes influencing the shape of the surface.
  • Receive Shadows Controls whether the surface receives shadows from static level geometry. In the current implementation, dynamic shadows are always cast onto the surface.
  • Material The material that is used to shade the fluid surface.

Emitter Settings

An emitter can be configured for surface rendering inside the particle system editor. See Particles for a description of how to configure an emitters for Flex. To make a Particle Emitter use surface rendering, open up Cascade, select the Particle Emitter and scroll to the bottom of the Details tab.

_images/fluidsurfaceEmitter.jpg

The following emitter and particle system settings have an impact on the look of the fluid surface:

Particle System Template

  • Materia The Blend Mode of the referenced Material used for particle rendering should be set to Masked.
  • Particle Scale Particle sizes should be tuned to get a good overlap of particles during the simulation.

Particle System Actor Details

  • Cast Shadow Enables shadows on static and dynamic level geometry and onto the surface itself.
  • Visible Should be set.
  • Render in Main Pass Should NOT be set. Otherwise particles are rendered inside the surface.
_images/FluidSurfaceEmitterSettings.jpg

Surface Material

The material referenced in the Flex Fluid Surface template is used to shade the surface. The surface rendering only supports a restricted material feature set. The Flex Project contains example materials that can be used as a reference.

  • Material Blend Mode: should either be set to Translucent or Masked
  • A special material expression FlexFluidSurface Thickness can be used to read the thickness of the liquid volume at a given screen location
_images/FluidSurfaceMaterial.jpg

Container

The main parameter that need to be adjusted in the Flex Container for surface rendering are shown here:

_images/FluidSurfaceContainer.jpg
  • Fluid Fluid surface rendering is mostly suitable for liquids. However, it’s not mandatory to enable the Fluid flag for surface rendering.
  • Anisotropy Scale If this parameter is set to larger than 0.0 the Flex simulation generates per particle information that can be used to improve the fluid surface rendering. The anisotropy information is used to render oriented ellipsoids instead of spheres which makes the surface look much smoother. Setting this higher allow the ellipsoids to stretch more. A value around 1.0 works usually well. The overall particle scale can be adjusted using the emitter particle size or with the Depth Particle Scale in the Flex Fluid Surface template.
  • Anisotropy Min Defines how thin a particle can become. It makes sense to limit the thickness for example to avoid shadowing artefact which can appear for very thin objects. A value around 0.1 works usually well.
  • Anisotropy Max Defines how thick a particle can become. It can look weird if ellipsoids stretch too much as the geometric shape can be become very obvious. A value around 1.0 works usually well.
  • Position Smoothing The look of the surface can be improved further by enabling smoothing of the particle positions. Values larger than 0.0 enable the particle smoothing.

Additionally it might be useful to adjust the Rest Distance of the Flex Container to achieve more visual surface details. The Collision Distance can be used to reduce the visual gap between the particle surface and the level geometry.