Making of Lava Flow with TexUVW


By Hammer Chen, Kristin Ivanova

Phoenix FD 4's new feature TexUVW opens a great opportunity for adding details to your fluids. It allows fluids to transport UVW information along with the moving fluid. You can find an example in the "Using TexUVW for Creating Thin Smoke" tutorial, available on the Phoenix FD official page. In the tutorial, smoke opacity is masked with a noise texture, with the help of TexUVW, to enhance the details that mimic thin smoke. 

In this article, we are taking advantage of this new feature in order to create a lava flow. The folding character of the lava is generated through bump maps and displacement.

When creating a lava stream, we need to consider what type of lava we want to use for reference. A variety of lava types exist depending on terrain, speed, hotness, and material composition. For the purpose of this article, we will create a "pahoehoe"  (pronounced 'paw-hoey-hoey") type of lava (see the reference images above), which creates folds as it moves. However, if you intend to simulate molten lava, you can check the "Solidifying of Molten Lava" tutorial on the official documentation site.

Scene setup
The simulation setup consists of the following:  a highly viscous liquid is emitted from Plane001, flowing down the slope of the Ground_Plane (with a Shelled Modifier applied). The flow then collides with several rocks, creating patterns in its TexUVW. Based on the animated TexUVW that follows the flow, we can then apply diffuse maps, bump maps and displacement to it.

Fluid Source
The liquid source is quite simply a standard plane. We mask the source with Stucco Texture, so the emission is not too uniform. A Noise modifier is added to the plane and set to animated. This way the liquid flows in different directions and varies in speed, making the lava collide with itself, generating interesting patterns in its UVs.

Since a plane with no thickness might not voxelize well when running the simulation, a shell modifier is added to Plane001. Then, we select one side of the plane and set the face IDs to ID 2. That's why we set the Polygon ID to 2 in the Liquid source. 

Another useful option of the Liquid Source is the "Inherit TexUVW From Geom". It sets the UVW Grid Channel value for each cell where fluid is emitted to the UV value of the emission geometry in that cell. When combined with the Variation option, it allows you to create an animated UVW pattern. If you are unsure of what it actually does, you can find an example here

Liquid Simulator
The first thing to look at here is the "Texture UVW". Be sure to enable the "Texture UVW" channel data in the Output rollout. Otherwise, the liquid won't contain any TexUVW information after simulation. 

The second thing you'll notice is the extremely low value of the Time Scale. This is because we want a slow moving lava flow. We also give some value to the Default Viscosity and Surface Tension options, as these two physical properties simulate thick and viscous liquids like lava.

The third important parameter is the Texture UVW Interpolation. In this example, we give it a value of 0.001. This parameter controls the frequency of Phoenix snapshotting the liquid mesh for UVW. When the Interpolation is set to zero, the TexUVW is determined in the first frame and continues to stretch over time, never to snapshot again. When the Interpolation is more than zero (0.1 for example), Phoenix snapshots the liquid mesh over a period of time and updates its TexUVW. The following table shows the Pros and Cons of these two extreme conditions. We choose in-between values (0.001) in this article for balanced results.

Other settings: SPF set to 2 for a more rounded thick liquid, it is okay to set SPF to 1 for a faster simulation. The Scene Scale is set to 8 for the same reason: the liquid appears thicker with a higher Scene Scale.

When the Interpolation is set to 0.1, as you can see, the TexUVW is less stretched. However, there is no realistic folding pattern that is usually seen in the "pahoehoe" lava. This setting is less expensive for computing, since you can run a rather low grid resolution and still get usable results.

When the Interpolation is set to 0.001, you can see patterns in the TexUVW, suitable for the "pahoehoe" type of lava. We still give the Interpolation a teeny tiny value instead of zero for balanced results. Notice we also up-res grid resolution in this example.

When applying a checker texture, you can see that  the leading edge of the liquid begins to update its TexUVW. So we set the Interpolation to 0.001 to avoid super overstretch of the UVs, hence, noisy mesh when we add VRayDisplacementMod to the liquid mesh.

The main topic of this article is TexUVW and we don't want to make it overly complicated. The whole idea of the shading network is simple: we have hot lava material and cold lava material, the two are blended with a VRayDistance Texture map as a mask (as shown in the image above).The hot lava is made of VRayLightMtl and the cold lava is made of standard VRayMaterial. So when the lava touches the rocks in the scene, it appears red hot, while other parts of the lava remain as cold and black. You can also add the ground plane in the VRayDistanceTex Objects list if you like to. The complete shading network can be found in the downloadable scene here.

To keep the scene simple, we don't use a Particle Turner, which allows you to manipulate liquid viscosity when particles age. However, when Particle Turner is used with PhoenixFDGrid Tex, you can get even more realistic molten lava, both in behavior and shading. That is worth another post or tutorial.

On top of the Phoenix FD liquid simulator we add VRayDisplacementMod. This modifier can turn the smooth mesh into a detailed one and make the pahoehoe lava mesh much more convincing.

Above are some images showing a variety of lighting conditions, different strengths of the applied displacement, and different TexUVW interpolation values. You can see distinct characters among them.

Final animation

Downable scene. Click here to download the final scene. Note that the texture maps and HDRI maps are not included in the package. You can download the texture maps from, and the HDRI maps from HDRI Heaven.