Table of Contents

This page provides a tutorial for adding foam and splashes to a liquid simulation.

Overview


This is an Entry Level tutorial which requires no previous knowledge of Phoenix. A basic understanding of Maya would be helpful but is not a prerequisite for being able to follow along.

The instructions on this page will guide you in modifying a liquid simulation to add foam and splashes.




Steps


When possible, build emitters and Simulators to real-world scale. Phoenix uses real-world calculations to create its effects, so working with real-world units will make your task much easier. E.g. a waterfall should be tens of meters tall (thousands of centimeters), while a glass of water should be 0.2 m / 20 cm tall. It does not matter which unit you choose for displaying the units - meters, centimeters, inches, etc., as long as it corresponds to the real-world size of the effect.

To follow along this tutorial, you must first go through the Creating a Simple Liquid Simulation tutorial, or if you already have an existing liquid-only simulation setup, you can modify it following the steps from this tutorial.




With the Simulator node selected, go to the Foam rollout and select Enable Foam. A message box asking if you want a particle shader generated will appear. Choose Yes.

Note that in the Outliner, 3 new items have appeared - a Particle Shader, a new set and a particle group inside the set.

The Particle Shader contains the shading parameters for the foam particles. You can choose the render mode for the particles, adjust their sizes and count, enable/disable Motion Blur, etc.

The phxParticle_set1 set is used to specify what particle systems the Particle Shader is responsible for shading at render time. In some cases you may want to have multiple particle systems drawn by the same shader, or multiple shaders drawing the same particle system.

Expand phxParticle_set1. Inside it there is the particle system for the Simulator's foam. You can think of the particle systems as references to the particles in the simulation. A single Simulator can create several particle systems and these particle system nodes allow you to pick individual systems in Particle Shaders or for example in the Phoenix Particle Texture.

There are five types of particles that the Phoenix Simulator can output - Liquid, Foam, Splash, Mist and Drag.




Any of these particles can be rendered using a Phoenix Particle Shader that references the particles in the Particle Systems set.




In the Foam rollout of the Simulator node, reduce the Foam Amount to 1. This parameter specifies the number of foam particles to be born when a given cell/voxel satisfies the birth condition, in thousands per second.

Reduce the Birth Threshold to 2.

The Birth Threshold specifies the velocity threshold above which the liquid is considered turbulent enough for foam birth. Foam birth only occurs under these three circumstances:
1. When a liquid experiences turbulent movement.
2. When a splash particle collides with the liquid.
3. When an emitter is adding foam particles to the simulation.

The Max Outside Age parameter specifies the age of the particle at which it would die if it exits the simulation grid.

The Size parameters control the size of the Foam particles. Even though it's possible to override those values at render time using the Particle Shader, it's a good idea to set them to some reasonable values because the B2B (bubble to bubble) Interaction relies on them.

The Variation Small/Large parameters specify how much smaller/larger the bubbles are relative to the Size parameter.

  • 0 means that all bubbles are always at least as small/big as specified by the Size parameter.
  • 1 means that the smallest/largest bubbles are two times smaller/larger than the Size value.

Size Distribution specifies how many times the amount of average bubbles exceeds the amount of the largest bubbles.

The B2B Interaction controls the internal interaction between bubbles. This option is used when the foam should pile up and form volume, like a beer cap. It forces a proper distance between the bubbles and keeps them stuck together. It's very useful when doing fuzzy drinks/beer simulations, and you'll notice that the Beer preset has some very specific B2B Interaction settings.




Start the simulation to see the result.

You can go to the Preview → Particle Preview rollout of the simulator and disable Show Mesh and the preview of Liquid particles by deselecting Show Selected System. This allows you to isolate specific particle types and troubleshoot their behavior.




Go to the Splash/Mist rollout and select Enable Splash/Mist. When prompted with a message asking if you'd like a new Particle Shader generated, choose Yes.

Keep the settings at their default values.

The concept of splashes in Phoenix is a bit more complicated than it is with foam. Simply put, splashes are generated when the surface of the liquid deforms. For more information, check FLIP Particles Life Cycle.

The lower the Birth Threshold parameter is, the more places on the liquid surface will produce splashes.

Splash particles are generated FROM the liquid - meaning that by default the liquid disappears and splash particles are created in its place. Then, when the splash particle returns back to the main body of water, it's converted back into liquid (controlled by the Affect Liquid parameter).

The Splash Amount determines how many splash particles are equal to a single liquid particle in volume. This value also affects the particle size - larger values decrease the size of splash particles.

Splash particles can also generate Foam when they hit the liquid surface. The Foam on Hit parameter controls this behavior.

Lastly, Splash particles can split into Mist particles while in mid air. During its motion, a splash particle constantly breaks down into smaller splash particles, ultimately converting to mist particles, decreasing the volume of the splash. The Split to Mist parameter controls how fast the splash particles are converted into mist.


Mist Shader Setup


Even though the tickbox reads Enable Splash/Mist, only a Splash particle shader is automatically generated. If you'd like to also render the Mist, follow the steps below:

First, create a new Particle Shader from the Phoenix FD Menu or from the Phoenix Self.

Set the Mode of the Particle Shader to Points.

Note that the set of the Particle Shader is empty. You need to manually add the particle system Particles_Mist_of_0_PhoenixFDSimulator1 to phxParticle_set3 (by middle button dragging the system under the set, or by editing the sets via the Edit Particle Systems button on the Particle Shader).




Also connect the PhoenixFDSimulator1 node to the Liquid Simulator slot of the Particle Shader, by selecting the Simulator and then shift+selecting the Particle Shader and pressing the Set Selected Object as Liquid Simulator button.




Run the simulation again.

Hide the Phoenix Simulator which is responsible for rendering the liquid mesh, and also the Foam and Splash Particle Shaders.

Hit render - you should now be able to see the mist particles rendered as points.

Show All
Show Only Mist




There are too few Mist particles and furthermore they are barely visible in the combined render when they are rendered as Points.

Increase the Count Multiplier of the Particle Shader to 10. This will create additional Mist particles at render time to make the mist render thicker.

Switch the Mode of the Particle Shader to Fog. Under the Particle Shader's Fog rollout, reduce the Fog Voxel Size to 0.1 (the same as the Simulator's Cell Size), and also increase the Fog Density to 1 to make the mist thicker.





That is all. You should now have a working particle setup with Foam, Splashes and Mist. Play with the Simulator properties and the Particle Shader attributes to get a good understanding of how everything ties together. You may also like to go through the Particle Shader tutorial or head over to the documentation page.

Show All
Show Only Mist