erizmr / SPH_Taichi

A high-performance implementation of SPH in Taichi.
MIT License
201 stars 40 forks source link

Demo video reproduction #22

Closed taehoon-yoon closed 1 year ago

taehoon-yoon commented 1 year ago

Hi, Thanks for your lovely project. Anyway I've runned python run_simulation.py --scene_file ./data/scenes/dragon_bath.json and what I saw was

capture

I was expecting like the video you've uploaded(with realistic water and objects). Is it somewhat related to the GLFW Error 65537: The GLFW library is not initialized? Which I got while running the code.

Thanks.

erizmr commented 1 year ago

Hi @sillsill777 , Thanks for your interest in this project. The image you posted here is the expected behavior. The GUI embedded in the simulator is only for fast preview use. For higher quality rendering, postprocessing is required. The video uploaded in the repo is rendered using Houdini Mantra with the data output by the simulator.

You can set exportPly in the dragon_bath.json to true so that the simulator can output the fluid particle data in .ply files. For two-way coupling case such as Armadilo Bath, exportObj should also be set to true to output the moving solids. Then load this files using the software you like for rendering.

taehoon-yoon commented 1 year ago

Thank you for your reply, as you mentioned, I've set exportPly to true in the dragon_bath.json file and runned the code. But I cannot see anything with the extension .ply, is there something I'm missing? Only file generated after the code is imgui.ini file.

erizmr commented 1 year ago

I have updated the script a bit. Could you please try again with the latest master? Thanks

taehoon-yoon commented 1 year ago

cap

It seems that ps.object_collection[r_body_id] does not have key corresponding to mesh. ps.object_collection[r_body_id] has the keys presented below.

dict_keys(['objectId', 'geometryFile', 'translation', 'rotationAxis', 'rotationAngle', 'scale', 'velocity', 'density', 'color', 'isDynamic', 'particleNum', 'voxelizedPoints'])

Sorry to bothering you

erizmr commented 1 year ago

No worries. It should work now. Please check the latest master.

taehoon-yoon commented 1 year ago

Hi there! I was checking your latest master. I set exportPly to True and then at some point scene blows up. I attached gif to describe what happend.

bad-gif

Also I tried it several time, file particle_object_0_****** inside the dragon_bath_output always ends at particle_object_0_000034. I assume at that point program blows up?

Anyway if I set eportPly to false, program works as a charm. Also I attach gif for the good result when I set exportPly to false.

ezgif com-video-to-gif

Thanks again.

erizmr commented 1 year ago

Thanks for reporting this. I tried to reproduce it and found that it only happens with the Taichi version >= 1.4.0. It works fine using Taichi 1.3.0. For workaround, you can try with Taichi 1.3.0. I am doing some further investigation to figure out what happens in the new version Taichi.

==============Update=============== I refactor the export pipeline and now it works with the latest Taichi. Also tried importing the output .ply and .obj into Houdini for a double check. image

taehoon-yoon commented 1 year ago

Hi there, with your modification, I was able to attain result enven with exportPly to true. (taichi version v.1.4.1). After I downloaded Houdini and somewhat managed to import ply files. (file -> import -> geometry -> particle_object_0_$F6.ply (0-426)) And this is what I get.

tmp

And the problem was with that bunch of buttons, I cannot figure out what I have to do. I clearly don't want you to walk me through every details to render scene in your demo video. But not to that extent, can I get any resouces or even some online video lecture link, guiding how to render like your demo video with the .ply files? If you can't find such a thing it is totally fine, at this point I already owe you too much.

Thanks again for all.

erizmr commented 1 year ago

Hi, there are basically several steps for rendering the demo video:

  1. Import the geometry files (e.g., .ply)
  2. Restrict the particles inside a bound box to avoid some unexpected edge cases using a bound box, e.g., a delete node
  3. Perform fluid surface reconstruction using Particle Fluid Surface node.
  4. Use the Houdini built-in CPU based mantra renderer to render images. It may takes few hours to render the whole sequence. Here is a video link for tutorial of fluid surface reconstruction and rendering: https://www.youtube.com/watch?v=AmnKMmEor9I
taehoon-yoon commented 1 year ago

Sorry for the super late reply. I was late because I wanted to show you my own result. With your amazing support and devotion I was able to reproduce the result as in your demo video. This is the final result.

default_rendered

Again thanks for your amazing project and kindness!! Becase of this, I was able to understand what SPH is. I wish your best luck!

Best regards, TaeHoon Yoon

erizmr commented 1 year ago

Congrats! The final result looks great!