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.69k stars 188 forks source link

Less whitewater particles are generated after increasing simulation frame rate #526

Closed rgferreira closed 3 years ago

rgferreira commented 3 years ago

I will updated this bug report with my ".blend" file this afternoon (CET) march, 30th.

System Information

Blender Version (including hash): 2.90.0, Hash: 0330d1af29c0 FLIP Fluids Version: 1.0.9a Stable 03-FEB-2021 Operating System: Windows 10 CPU: Intel i7 6700k GFX: Nvidia GeForce RTX 3090 RAM: 32 GB

Description

Whitewater simulation particles are missing when changing the simulation frame rate from 30fps to 60fps.

To Reproduce

After setting up a simulation, I changed the scene frame rate from 30fps to 60fps, without changing the Flip Fluids frame rate in the add-on settings, which stays connected to the scene frame rate. I unlink all Flip Fluids elements and link them back again (2 obstacles, 1 fluid, 4 inflows, 4 outflows). Then I re-run the simulation and all the whitewater elements (foam, dust, bubbles, spray) are no longer simulated. If I go back to 30fps (always under the general render settings of Blender) and re-run, then everything is OK again, so I guess this is related.

Expected Behaviour

The whitewater simulation particles (foam, bubbles, spray, dust) should not disappear.

Actual Behaviour

The whitewater simulation particles (foam, bubbles, spary, dust) are no longer simulated unless switching back to 30fps.

Screenshots

No screenshots needed.

rlguy commented 3 years ago

Hi rgferreira,

Thanks for the report! This issue is caused by a side effect of how the whitewater simulation works.

Whitewater generation works by placing many particle emitters in areas of the fluid where particles are likely to be generated. The number of particles a single emitter generates depends on a few factors such as emission rate, kinetic energy, sharpness of wavecrests, and amount of turbulence.

An emitter generates particles at a certain rate per second and that number is determined by the simulator. Emitters only last for a single frame before being re-seeded throughout the simulation again, and a side effect of this is that increasing frame rate can lead to less particles being emitted. Here is an example:

Suppose your frame rate is 30fps and the simulator determines this emitter's particle rate to be 30 particles per second. That would mean the emitter would emit a single particle in a frame. Now lets say you increase the framerate to 60. If the emitter is generating at 30 particles per second, it can now only emit 0.5 particles per frame. Emitters can only emit a minimum of 1 particle, so the 0.5 particles round to 0 and the emitter ends up generating nothing.

Usually emitters generate many more particles per second than the frame rate and this is not an issue. It sounds like you may need to tune the whitewater settings for more suitable particle generation. If the emitters no longer generate when doubling the FPS, this usually indicates that the Min/Max Energy Speed values need to be changed. These are the fluid speed values where whitewater is triggered and you might want to lower the Min/Max values to closer match the actual velocity of the fluid (note that small scale scenes tend to have slower moving fluid than large scale scenes). After that, you may want to increase the Wavecrest/Turbulence Emission Rates.

Hope that explanation makes sense!

See this topic for how to increase whitewater generation: Simulation not generating enough whitewater (foam/bubble/spray)

We also have a two part video guide that can help explain how whitewater generation works here: https://youtu.be/RLPPS_w8Bjo

- Ryan

rgferreira commented 3 years ago

Dear Ryan,

Thank you so much for your, as always, detailed answer. I completely understand what you describe, and before posting this I tried to lower the min energy speed to 0,10 but no foam or bubbles particles were simulated at all. I will try even lower values. Would a "smart time rescaling" be an interesting potential feature? A tool that would automatically change time-dependant parameters in order to respect the original simulation when rescaling time. Thank you again.

rlguy commented 3 years ago

That would be a helpful feature to add, but could be complex to implement. These types of problems are difficult to detect before the simulation has already been run.

I think a solution to help avoid these problems might be to have the addon automatically adjust or adapt the Min/Max Energy values to a good range depending on how the last few frames have performed.

Another solution could be to change the way particles are emitted and store the rounded down energy that is lost so that future frames can use this to emit more particles.