logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Creating Fluid Simulation Completely in Blender

LARK told us about the working process behind the Private Beach project, shared what challenges they faced while creating it, and gave some useful tips for those who'd like to try making fluid simulations. 

Introduction

My name is LARK and I am a Video Editor from Japan. I don't use 3DCG in my main job, and I study it on my own in between work projects. It's been about a little over a year since I started studying in earnest. Thanks to the pioneers, Blender has a lot of information on CG software, so I like the fact that it is easy to create works even if you are self-taught.

References and Goals

I have always been interested in various kinds of art expressed in 3DCG, and I especially loved the simulation type that I could watch over and over again. For this reason, I purchased the FlipFluid add-on shortly after I started working with Blender, and created a few test scenes. However, I found that the simulation baking and rendering took a lot of time, even for small scenes, so I didn't create simulation-based works very often.

And yet, I have had the desire to use fluid simulation to create scenes that combine actual scenery such as rivers, oceans, and lakes. This time, I was able to find the time, so I decided to work on an idea I had been thinking about for a while.

My first step was to find out if I could actually use FlipFluid to create the kind of scene I had in mind. For this, I used YouTube to find the examples of various people's works, and compiled a list of works that I felt were ideal simulations. After some deliberation, I decided on the goal of "creating a photo-realistic beach" and started collecting references.

I had a number of ideas that I had tried to bring to life as a large project in the past. Although at the time, I had failed in the process, so for a new project, my top priority was to be able to complete it well. Therefore, I wanted to make a relatively small isometric scene, and collected images that would fit the image. Below you can see the actual reference images I collected. 

Setting Up the Scene

The first step was to start working on the rough layout of the scene. There are not many images left of the work in progress, and what you see in the image below is a layout from the very early days. As you can see, I just roughly placed the primitive objects. I took a vague image and turned it into a concrete form. There are ways to draw rough pictures or create roughs in Photobash using live-action materials, but I'm not really good at both these ways, so I used Blender from the start.

The scale of the scene at this stage was much larger than the final one turned out to be. Besides, initially, I planned to have a larger number of objects. However, when I tried to run a simple fluid simulation in parallel with the layout, I faced a problem of the the simulation computation time.

If you want to simulate waves that are close to reality, you will naturally need to adjust the scale as well. The scale of this scene was quite large – more than 100 meters vertically, but even the low-resolution simulation for testing took a huge amount of time, and I had to wait for quite some time to see the results of how the waves occurred. Since it would be difficult to complete the project within the time frame, I decided to change the direction of the project and switch to creating smaller scenes.

Below you can see the final scene I created after several adjustments. Most of the elements from the original scene were removed, leaving a simple beach. Besides, I decided to make a tabletop interior that looked like a beach in a case.

I reviewed the workflow as well. First of all, I focused on creating the "ideal wave", and then I ran test simulations while changing the layout. Depending on the results of the simulation, I fine-tuned the placement of the rocks and the topography of the beach.

Waves Simulation with FLIP Fluids

Flip Fluids, which is the heart of this workflow, differs from the standard Blender Mantaflow as it is specialized for fluid simulation. When I first started using Blender, I did several tutorials on fluids using Mantaflow, but I was very confused by the fact that the UI and calculation results differed greatly depending on the version of Blender.

In addition, Mantaflow can also simulate non-fluids such as smoke and flames, but because of this, it has a large number of settings, which made it more difficult to understand. In this regard, Flip Fluids has a lot of settings and looks complicated, but once you get used to it, the UI is easy to understand, and above all, the official tutorial videos and documents are very substantial. And even if you upgrade, the UI basically remains the same. So you can refer to past tutorials and use them as they are.

In the image below, the left image shows the menu displayed in the sidebar, and the right image shows the menu displayed in the properties panel.

The sample scenes that users can download are designed for a variety of cases, and the actual project data is distributed so that you can carefully examine the contents. I especially like the command line tool, which does the simulation baking and rendering in the background without using the Blender UI. Thanks to this, Blender rarely crashes even under heavy load, giving you peace of mind when processing all night long.

Waves

For the actual fluid simulation part, I used the YouTube video uploaded by Remington Creative as a great reference. The video is very informative and the author summarizes the details of how he uses FLIP Fluids to create the ideal wave. Of course, this is not an introduction of values that can be used as it is, but rather a way of thinking, so you will need to adjust the values according to your actual situation.

The other thing I referred to was the tutorial by CG Geek. The first and second parts are quite long, and the author uses an older version of Blender, but the tutorial still was very helpful.

Also, although it's not a tutorial, Artell Blender's work is very nice and looks like the ideal beach for me, which was my final goal for this project.

I don't know other fluid simulation than with Blender and FLIP Fluids, so things may be different for other software, but at least for this work, there is no need to reproduce real world phenomena in detail to create waves.

If you're using Blender, you can perform a fluid simulation calculation by preparing four major objects:

  • Domain –  to specify the range for the calculation;
  • Fluid – box to define the water to be used for the calculation;
  • The beach as a base (Obstacle);
  • Objects for creating waves (Wave Object).

I'm afraid it's very hard to understand, but this is what it looks like in the diagram:

When you start the simulation, the fluid is generated according to the size of the object in the wireframe display named Fluid, and the object used to create the waves (Wave Object) animates up and down on the spot to push the fluid out. After a certain amount of frames, the waves are generated and launched onto the beach.

The way waves occur in reality is due to more complex natural phenomena and the shape of the terrain, but it can be reproduced in a simplified form like this. The beach object needs to have a certain height to stop the waves that are generated, so it is made to have a steep slope rather than a gentle slope like a real beach.

You can set a friction coefficient for the beach object in the FLIP Fluids settings. The coefficient of friction makes it possible for the waves that are launched to gradually slow down and stop instead of sliding along the beach and reaching the end of the beach.

The topography of the beach has a lot to do with whether or not the ideal shape and movement of the waves can be created, so the shape of the beach was modified several times through repeated test simulations.

By the way, terrain objects (obstacles) in the simulation must be closed meshes, not Non Manifold. In the case of the standard Mantaflow, you can simulate a flat object without thickness, but in FLIP Fluids, if the object is not thick enough, the obstacle object cannot be detected and water will leak.

The image below shows the beach object as seen from below. You can see that there are no faces attached to it, so it is not a closed mesh, which will cause errors in the simulation.

To generate bubbles with FLIP Fluids, you just need to put a check on Whitewater and select the elements you need. You can control the amount of bubbles, etc. produced by adjusting the value here. I tried the item on dust several times, but couldn't figure out if it was being generated, so I unchecked it.

If you run the simulation in this state, Whitewater will be generated by the collision of fluids.

Initially, I tested the simulation without placing anything on the beach, but the waves felt monotonous, so I placed rocks on the beach as obstacles and set the friction coefficient. By doing this, Whitewater will also be generated when a wave hits a rock.

The friction coefficient was also set for the beach itself, but the Whitewater Influence value was adjusted to a larger value to generate more Whitewater when the waves were launched. I fine-tuned it a few times, because too much Whitewater produced would result in a foamy state, as if the detergent had been mixed with it.

As you can see, the amount of Whitewater generated can be controlled by the parameters of each object, but for example, if you want to increase the amount significantly, you can generate more bubbles by increasing the resolution of the simulation itself.

However, the amount of computation would increase proportionally, so I alternated between simple tests and detailed simulations with higher resolution to aim for the state in which the ideal waves and Whitewater were generated. I also had to apply the material to the waves and the generated Whitewater.

FLIP Fluids has material presets, so you can use them by simply selecting them from the settings section.

In this scene, I did not use the standard ocean volumetric material because its green color was too strong and did not match the scene as I was expecting a tropical blue sea. I could have used the shader editor to change the hue, but I used the RealWater material distributed by Remington Creative, whom I mentioned earlier.

Main Challenges

Creating bubbles, an essential element for photo-realistic waves, was one of the challenges while making this scene. They could not be generated at the ideal proportion being too much or too little, so the simulation needed to be repeated many times. I also referred to various people's tutorials and documents, but it took me a huge amount of time to verify how each setting affected the other.

One of the biggest problems was also the large number of frames that had to be simulated. The fact that I chose the ocean as my subject this time was a particular problem as it takes at least 300 extra frames to generate a beautiful wave, and every time I simulated a test, it took a lot of time.

This time, I set the final simulation resolution at 350, but changing the value in this section would change the results significantly. This was also one of the reasons why I had to repeat the test. As mentioned in the official documentation, increasing the resolution would create new objects. Therefore, a new calculation was required, and as a result, there was a big difference from the previous simulation results.

I also had problems with Whitewater not being able to be seen during normal rendering, which is done by pressing the F12 key. This seems to be a problem caused by Blender, not the add-on, and an error occurs when syncing a large amount of geometry to the renderer, so Whitewater disappears.

Since I couldn't check the crucial Whitewater at all in this state, I used the aforementioned command line tool of FLIP Fluids to render it instead of the usual rendering. By doing so, I could avoid the aforementioned problem and render correctly. However, since I couldn' t check the results until I exported them as still images, it was quite troublesome to use them for each check.

The image on the left is the state that the bubbles disappeared by normal rendering.

I also used a WetMap for the beach to make it look more realistic. WetMap is used to control the wetness of the ground, and by using Blender's Dynamic Paint function, I could detect the grounded part of the fluid simulation and generate a black and white map.

In the image below, you can see a part of a sequential numbered file of WetMap.

I used the generated WetMap as a factor. The Base Color and Roughness values were changed accordingly, and the beach color became slightly darker and started being reflected because of the wetness.

This is an image of the viewport rendered in material view to see how the WetMap works.

To check, no amount of time would be enough to do production rendering each time, so Blender's viewport rendering function was a great help.

Here, I encountered a problem that Blender would frequently crash when baking WetMap by Dynamic Paint function. It seems to be a bug that has been around since about Blender 2.8, but when baking by Dynamic Paint function. If you don't minimize the window of Blender, there is a high probability that the software will crash. It still happens in 3.0, and I lost a lot of time because of it.

If I had to give some advice for those who want to try fluid simulation in the future, I would recommend a subject that is on a smaller scale, does not take as long to check, and does not require a preliminary frame. Also, since the computation speed is greatly reduced when Whitewater is enabled, you might want to enable Whitewater after trying it at a lower resolution for roughly fluid motion. However, small scales have their own difficulties, so I recommend that you read through the official tutorials.

It is also recommended to use a high-performance PC if possible. Simulation baking is done on the CPU, not the GPU, and higher resolution scenes require large amounts of memory. Be aware that unlike modeling and texturing tasks, which do not require much PC specs, fluid simulation may not allow you to create what you want depending on your PC specs.

For reference, my PC specs are as follows:

  • Ryzen9 5950X
  • 64GB RAM
  • RTX 3090

Lighting

For the lighting of the scene, I tried various methods such as adjusting the lighting from scratch by placing lights from a completely dark state, or using Nishita of the Sky Texture in Blender, but in the end I used the Secluded Beach HDRI distributed by Poly Haven.

As the name implies, it's a coastal HDRI, so it's a very good match for this scene. I rotated the HDRI to adjust the position of the shadows and intensified the brightness to create a "summer sunshine feel" with a strong contrast ratio.

The contrast was so strong that the shadows became dark, so I placed some lights to illuminate the area. I rendered a total of 600F, from 300F to 900F, where the waves were most beautiful. After testing, I found that the glass part was prone to noise, so I set the number of samples to 1024 and denoised it after rendering.

Rendering

The project was created in Blender 3.0, and I was expecting a fast rendering using the latest version of CyclesX, but in reality, the Initialization and Synchronization sections before rendering took a huge amount of time, up to 2 minutes per frame. I tried several ways to work on them, but with no improvement, I decided to render from the command line tool of FLIP Fluids during the night, and after a few days I managed to finish it.

I used Blender's compositing settings to test color correction, etc., but did not use it in the final product. I ended up importing the sequentially numbered file in After Effects, which I use regularly, to make minor adjustments and add blur. After that, I did the final color correction in Premiere Pro. This time, I used vivid colors throughout to catch the eye on SNS.

Summary

Although the scale of this work is much smaller than the initial image, I feel that I was able to create the rich waves that I had imagined. Unlike my previous works, I am very happy that so many people have seen my new project.

However, I have a few regrets. One of them is that the period of the waves crashing on the beach had become too short caused by an attempt to make the waves more picturesque and attractive. Additionally, I was not able to add animations of palm trees swaying in the wind, sounds of waves, and other elements that would have enhanced the work. I would like to make use of the experience I gained through this production in my future works.

At the moment, Blender is my main tool, but as a simulation enthusiast, I would like to use Houdini in the future.

LARK Production, 3D Artist

Interview conducted by Arti Burton

Join discussion

Comments 1

  • Anonymous user

    Well done!
    Lots of useful information here, thank you for sharing.

    2

    Anonymous user

    ·2 years ago·

You might also like

We need your consent

We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more