rlguy / Blender-FLIP-Fluids

The FLIP Fluids addon is a tool that helps you set up, run, and render high quality liquid fluid effects all within Blender, the free and open source 3D creation suite.
https://www.blendermarket.com/products/flipfluids
GNU General Public License v3.0
1.64k stars 185 forks source link

Whitewater particle simulation inconsitency when min-substeps changed and keyframed #516

Closed MPalmieri422 closed 3 years ago

MPalmieri422 commented 3 years ago

Issue present on both OS's and versions of the add-on.

Blender Version (including hash): 2.91.0 (of45cab862b8) FLIP Fluids Version: 1.0.9a and 1.0.9 Operating System: Mac 10.15.7 (Catalina) and Windows 10 CPU: Mac: i9900K 3.6GHz, Win 10: Rysen 2600X GFX: Mac: Vega 48, Win 10: RTX 3070 RAM: Mac 64GB, Win10 16GB

I am producing a scene where a container of fluid is animated and I am using FlipFluids to simulate the fluid and particles and how they interact as they move in the animated container. Because the container moves quickly I was finding fluid volume loss was becoming an issue, therefore I went to adjust the simulation minimum substeps to help correct this, it did remove the volume loss however the simulation of the Whitewater particles were not consistent.

I found two issue, the first may not be a bug just a consequence.

Firstly) When the number of minimum substeps was increased the production of whitewater particles drastically reduced as the min substep value was increased, I have attached images which show going from a minimum subset of 1 to 10 to 15 and the particles reducing.

frame 15 substep 1 frame 15 substeps 10 frame 15  substeps 15

This all had the CFL value to 1 to fully use the adaptive substeps for the obstacle. I found that this issue did not change when adaptive substeps was unchecked or when the CFL value was increased to 5.

I would expect to see at least mostly consistent particle simulation as the substeps improved or is this normal for white water particles to be reduced when using high substeps. Alternatively is this an issue with some particles being removed every substep causing a greater reduction in particles the more substeps used.

Secondly) Also related to the substeps, think this may be a bug.

When I keyframe the min substep value in any way the simulation of whitewater does not produce anywhere near the same amount of particles. Below is a comparison of applying a keyframe and without.

frame 14 substep 1 NO keyframe frame 14 substep 1 keyframe

I have found that the adaptive time stepping does not make a difference but by increasing the CFL value back upto 5 some of the particles are simulated again but no where near to the same extent as without any keyframes. This issue also persists when the max substeps are keyframed and when the keyframe was not at the first frame, the location and number of keyframes does not matter. Also this does not only occur when substeps of 1 are used, it persisted with higher substeps.

I would not expect the simulation of the whitewater to change when just key framing as the substeps are still the same for the frames between the examples.

This is occurring on both Mac and Windows 10 for me and is also present in the 1.0.9 version which I went back to to check if it is an error with the latest version.

The relevant .blend file I use and you can test with is too large for this upload so here is a google drive link: https://drive.google.com/file/d/1ko7ye6BiroQ6P5SCgzp3L0wSDn9GgRqf/view?usp=sharing

I hope this is clear and you are able to reproduce it, I have not done one of these posts before. I have troubleshooted with changing the grid world size, resolution and some whitewater emission setting but did not eliminate these issues regarding the Substeps.

hope you can help thanks Mark

rlguy commented 3 years ago

Hi Mark,

Thanks for the detailed report and .blend file! I am able to reproduce this keyframing issue, and I have confirmed that this is a bug. It looks like this bug has been in the addon for a long time (October 2017), so it is great to know about this issue.

I have compared the simulation log files for when the time step value is not keyframed and when it is keyframed. It looks like the bug is causing other simulation settings to be overwritten when the setting is keyframed. When no keyframes are added, the simulation settings are correct.

default_values_overwritten

A side effect of these simulation settings being overwritten is that much less particles will be generated.

I think I have found a solution to this bug, but will need to do some testing to make sure that this fix does not break other areas of the addon. I will update you when this issue is fixed and provide any workarounds if possible.

The first issue that you mentioned is a consequence of adding more substeps to the simulation and I will give an explanation for this in another message.

- Ryan

rlguy commented 3 years ago

After testing the fix, it seems to be working well. This fix will be available when the next stable version is released (Date TBA), or in the next experimental release which will be available either on February 10th or 17th.

Workaround for FLIP Fluids 1.0.9a

A workaround will involve replacing one of the FLIP Fluids addon script files.

  1. Extract export_utils.py from this attached .zip file: export_utils.zip
  2. Copy this file in your FLIP Fluids addon script directory at this directory location: flip_fluids_addon/utils/

See this documentation topic for how to locate your Blender addon scripts directory: Finding Your Blender Addons Directory

Let us know if you have any questions.

Issue 1

I found two issue, the first may not be a bug just a consequence. Firstly) When the number of minimum substeps was increased the production of whitewater particles drastically reduced as the min substep value was increased, I have attached images which show going from a minimum subset of 1 to 10 to 15 and the particles reducing.

This issue will be a consequence of increasing the number of substeps. A side effect of increasing substeps is that less particles can be generated.

The reason for this is that particles are emitted in a location at a certain rate per second. The rate depends on a few parameters such as fluid speed, turbulence, and wavecrest sharpness. Particles are emitted during every substep and in a single substep, the minimum number of particles that can be emitted is 1 particle (half or fractional particles cannot be emitted).

For example, if the emitter rate is calculated to be 30 particles per second at 30fps and 1 substep, there will be a total of 30 steps in a second. So 1 particle will be emitted at each step.

But if there are 2 substeps per frame, then there are 60 steps in a second. That leads to 0.5 particles emitted per step. Since fractional particles cannot be emitted, this is rounded down to 0 particles emitted per step.

In cases where increasing substeps drastically reduces the number of particles, you will want to increase the rates that particles are emitted. This can be done by increasing the Wavecrest/Turbulence Emission Rate whitewater values. More details on how to increase particle emission can be found here: https://github.com/rlguy/Blender-FLIP-Fluids/wiki/Scene-Troubleshooting#simulation-not-generating-enough-whitewater-foambubblespray

We also have a two part video tutorial that goes into more depth on how whitewater is generated here: https://youtu.be/RLPPS_w8Bjo

Hope that explanation makes sense!