Water Simulation for Flowing Rivers

Download Houdini File: FLIP sim River Flowing_CORRECTED.hiplc

Download Houdini File: FLIP sim River Flowing_python_script_CORRECTED.hiplc

Read below for information on the python script.

There were a few requests that came in for the River Flowing project file. So I finally got around to fixing this old project file up and get it ready for sharing. The River Flowing tutorial video was one of my first videos made at the beginning so I didn’t start providing HIP files until later on and unfortunately the FLIP simulations take forever to cook so that was my excuse for not uploading this sooner. Sorry for the long wait!

 

Recreated Rocks

In the original tutorial video, the rocks I used in the river scene were assets I bought online and I can’t share those. I have recreated two new rocks and replaced it in the scene. They are just a couple of spheres where I threw on some noise with the PointVOP to give it some random shape.

Python Script to Automatically Recook File Caches

Python Script node in Houdini

Python Script node in Houdini

I added a Python script to this Houdini project which will recook all the file caches all over the entire scene automatically. Hopefully if you have the patience, you can recreate the scene this way. It does take VERY long to cook and I found that the python script node is a little awkward to work with at first. I haven’t have much experience with it, so I might just be using it the wrong way.

In order to trigger the Python script to execute, you need to select the Python Script node (indicated in red in HIP file) and place the render flag on the node and click something else. That should trigger the whole process.

This can get a little annoying after the first cook, so I also provided a Houdini project that doesn’t have the python script, because the python script will load everything when you select the python node. Since the scene is very large this process takes forever. (Please scroll down to the bottom to read how to use both HIP files together for best convenience.)

Specify Total Frames to Cook Simulation

There’s a handy Total_Frames parameter I put on the python script node that will enter the End Frame values for all the file caches in the scene project so you can easily adjust how many frames you want to cook and cache the simulation.

Python Script node controlling all End Frame parameters in File Caches

Python Script node controlling all End Frame parameters in File Caches

How to Use Both HIP Files?

On the top of this page, I included two versions of the same Houdini Project file, one of them contains a Python Script node that automatically recooks all the file caches that are located in the Houdini project and the other HIP file is the exact same project except it doesn’t have the Python Script node. The purpose of doing this is to make it a little more convenient for everyone to use. The Python Script node starts executing everything and recooks the simulation every time you select the node and this may be good for the first time you cook the simulation, but not afterwards.

Therefore you can use one the HIP with Python to cook and the HIP without Python for working afterwards. Working with the HIP without Python makes it convenient to avoid accidently triggering the recook script.

  1. Download both HIP files and put them both in the same folder location on your PC.

  2. On the first time of opening this project, open the HIP project file WITH the Python Script node.

  3. Then run the Python Script to cook out the simulation for the first time.

  4. Close the Houdini project.

  5. Now reopen the other HIP file that DOES NOT contain the Python Script.

All the caches that were cooked should automatically be loaded. This is because I have removed all the $HIP from the file caches and both HIP project files are reading file caches from the same location. As long as both HIP files are located in the same folder, this should work. I use this trick quite a bit when organizing my tutorial files.

Correction to HIP Files

Object Mask filtering in Dopimport node in Houdini

Object Mask filtering in Dopimport node in Houdini

By the time you’re reading this, the HIP files will have been corrected and this shouldn’t affect you in any way.

In the initial post of this article, I uploaded two Houdini HIP files that have the exact same scene setup, but I forgot to filter the flip object in the dopimport node. This shouldn’t affect the quality of the render, but should improve the performance a tiny little bit, because you no longer file caching both the terrain and the flip object. This should make the cache files a lot smaller.

I don’t think it will affect the fluidcompress or particlefluidsurface nodes, because the fluidcompress node only compresses the fluid geometry and it seems to ignore all other.