taichi-dev / taichi_blend

Taichi Blender intergration for physics simulation and animation
156 stars 13 forks source link

Production ready realistic water simulator #9

Open PavelBlend opened 3 years ago

PavelBlend commented 3 years ago

Hello, @archibate

I have a suggestion: create a realistic water simulator based on taichi.

To make the simulator produce realistic results. Something like this:

Blender El'Beem Fluid Simulator: youtube

Aquarius Fluid Simulator: youtube

And implement the following features:

voxel simulation method sparse domain diffuse viscosity (very low viscosity for water) surface tension air incompressibility very simple interface, no nodes required faster calculation compared to elbeem

Air incompressibility example: vimeo

There is currently no simulator in blender that can quickly simulate realistic water. There is a lack of a simulator that is well suited for simulations ranging from 10 cm to 1 meter. Mantaflow is not stable and takes a very long time to compute.

archibate commented 3 years ago

Thank for the suggestion! Will we use MPM or some other methods for solving the fluid?

There is a lack of a simulator that is well suited for simulations ranging from 10 cm to 1 meter.

What do you mean? I thought the Blender's built-in one is already very suitable for that?

PavelBlend commented 3 years ago

Will we use MPM or some other methods for solving the fluid?

I am not knowing which method is the best to use. But it seems to me that it is better to use the voxel method, which has no particles. And don't use hybrid methods. Voxel is faster than MPM. And the voxel method can be improved in the future to maintain the incompressibility of air and the miscibility of different colored liquids, liquid dissolution, etc.

Examples: https://youtu.be/MIcUW9QFMLE?t=356 https://youtu.be/IiqFAFrgHZg?t=17

But this is my subjective opinion. Maybe I'm wrong and it's better to use MPM or FLIP or APIC ...

What do you mean? I thought the Blender's built-in one is already very suitable for that?

Mantaflow is unstable and slow. Both mantaflow and flip fluids addon cannot create a very realistic fluid. Like here: water-wallpapers-12

archibate commented 3 years ago

Hi, to dump my air simulation data to blender, I have to ask: How do I load a pyopenvdb.FloatGrid into Blender as a volume object? Or: How do I load a dense volume of np.ndarray into Blender as a volume object?

Do I have to ask the user to click Import from OpenVDB in object context menu and select my hinted temp file (/tmp/a.vdb)? Do we have an API like bpy.volumes.import_from_file('/tmp/a.vdb')? Or even better bpy.volumes.import_from_memory(my_vdb_grid)?

What's more, I found that pyopenvdb seems only available in Linux platform... But I just want to load a dense volume? How can load it into Blender?

PavelBlend commented 3 years ago

@archibate, Hi.

It is possible to make a separate program that does not depend on blender. It is possible to create a separate repository that has nothing to do with taichi_blend. And in the future, you can create an integration in blender.

If you start writing a water simulator for blender right away, problems and limitations can arise. And it's harder to write than a stanalone application.

archibate commented 3 years ago

Yeah Blender really doesn't provide good enough API at this moment... I would be happy to render the generated volume data with Cycles... So we will give up Taichi-Blend for now, use my Taichi-THREE engine for rendering volume data, only back to Blender after the required APIs are mature? So sad about how much I've been working in Taichi-Blend...

shankarsivarajan commented 3 years ago

@PavelBlend I can't get this file of yours (from the taichi_elements repo) to work with this addon, but doesn't that already pretty much do what you want? I don't know how to create it, but an addon that just simplifies adding nodes already written seems relatively easy, at least compared to trying to create a new simulation method. Also, that file looks great, with lots of different elements simulated simultaneously, and I'd love to try it, but all the nodes say "Undefined socket type" when I open the file. (I get the same error on the files from taichi_elements_blender_examples.) Do I need to follow the messy procedure for installing the taichi_elements package separately, or is this taichi_blend enough? I can import taichi_elements in Blender's python console.

shankarsivarajan commented 3 years ago

@archibate While I agree that Blender's Python API could be better, importing .vdb files works as well as you could ask for: bpy.ops.object.volume_import(filepath="\path\to\volume.vdb\") You can also import a .vdb sequence with a similar command.

(Blender conveniently prints out the corresponding API command for every GUI action, so you can just import a sequence manually with Add > Volume > Import OpenVDB, and copy the command printed in the scripting panel to use in scripts and addons.)

Btw, this is an excellent addon. Thank you.