Realtime GPU smoke simulation

Hi, I’ve just started working on Realtime Smoke Simulator running on the GPU. It’s a very early work but I’ve just managed to get some results of my work. My method allows to run in almost real time using 512x512x512 domain. (There is no adaptive domain yet). This test renders can be seen in the links below.

For now it’s a standalone program (even without graphical interface yet) but in the future I want to make it as an blender addon or even built in blender next to Mantaflow.

The only problem is time. Because I’m just a student now and I’m also an AI researcher I have very limited time so if you are a programmer or you know someone that would like to help with this project please contact me in the comment section because every help would be great :smiley:

Have a nice day everyone!!

Tests:


32 Likes

WOW, that would be nuts! Unfortunately not a programmer myself and not much of a help. just wanted to let you know that I appreciate your work. Since I saw those jawdropping demos from JangaFX I hoped someone would come and try to implement something like that into blender or as an addon.
Love the blender community, i need to get into coding sometime haha kinda scary

Hope you will find the help you need!

3 Likes

Wow it looks like you have already made some great progress. Those demos both look really good and the ability to do it in real time could be a real big gain.

Would you be proposing this as an add on to Blender, or integrated into the current smoke system (as it’s own solver…?)

I just noticed the add-on tag and was wondering. I don’t think that addons support any other language than what Python gives you. I mean, maybe you could do it as a Python extension with a .so or .pyd module?

This is awesome though, really great demo!

1 Like

Thank you,

At first it would work as a standalone app that allows you to import obj files as inflow/collision and export simulation as OpenVDB.
Next step would be make it as an addon (The app core would be in C++ but there would be a bridge in python with user interface inside blender) It would work similar to Flip Fluids addon where also the main part is in C++
And if it would be stable and production ready I would try to implement this inside Blender code next to Mantaflow and try to push it to the master branch.

8 Likes

What’s your current build system like? Do you use CMake or…?

I don’t really know about your code in specific, but I do a little Blender coding and have a set of Blender as a Python module wheels that I use to do it, that way I can use VS Code and modern dev tools.

Anyways, I know I have heard of SWIG, doing interop with ctypes, Boost.Python, etc. For the Python wheel of Blender as a Python module I got setuptools to distribute the result of a cmake operation, so if you need general help in making a Cmake build system install into a python module I could help you there.

I’m not entirely sure where you need help to be honest. Sounds like the first step you mention is automating the app you already have. Does your app already import .obj? If so, a sample script could probably easily be made in Python, that exports an OBJ from Blender and calls your program from a known directory right after.

The addon would be tougher but still doable. It would take knowing how the code is set up to understand what that would look like better.

Thank you for your attention,

I’m currently working in Visual Studio 2019 because I’m used to it but when the code is ready I’ll try to do it multiplatform.

It’s in very early development and it was mainly made as a proof of concept and it does not not have any input/output modules yet and everything is hardcoded but I’m starting to do a research in it.

For now I would mainly need help with developing the solver and adding functionality to it. For example I would like to add adaptive domain to speed up baking even more, add fuel rendering, basic force fields, noise for adding details to the smoke, etc. Also I would love to overcome the issue of memory limit on the GPU (for now if the domain resolution is very high and there is not enough memory on the GPU to load full scene it would not bake because of lack of memory) The domain of size 512^3 needs about 6GB. I have some ideas but it takes time to implement so having someone to help would be awesome.

But the main goal for now is adding collision objects.

If you want I can add you to my github project (it’s private for now but I’ll change it in the near future (mainly when the code is less messy because it is my first simulator))

3 Likes

I’ll give anything a look, at least once, but I am admittedly no GPU coder, and have little domain-specific knowledge in this area, so full disclosure: I’m not sure what insight (if any) I would have to give at the simulation portion of it, and much less the performance portion of it. So I would understand if you didn’t care to add me to your repo; that would be no hard feelings if you didn’t want to because of that.

Wow, this deserve to be seen by @sebbas :slight_smile:

Actually I’ve just made it public. But it would need a full rewrite in my opinion.

3 Likes

Wow, really cool! I will look at it probably tonight. This deserves way more attention, really.

1 Like

Hello @michal1000w,
This project is really interesting.
You should write some documentation, even if this is a prototype.
I successfully build it with no errors but nothing happens next…
Good luck!

2 Likes

Hi,
After launching it should write how much memory it uses and should update information about simulation time and computed frame. However it may not found output folder and that’s why it didn’t do anything and closed immidiately.

I will definitely do a documentation because it is a necessary step but I’m planning on doing heavy rewrite soon so I’ll do that after clean up.

Thank you very much for support :smiley:

3 Likes

I will retry it with the output folder!
Thank you

The simulation works with an output folder, thanks for the info!

REALLY looking forward for your work! :grin:

1 Like

This looks really cool! Is there any hope for AMD GPU support?

Yes, finally I will port this program to OpenCL because I want to include all platforms to benefit from my project, however I know CUDA a little bit better so for the development part it will only work on NVidia cards

The time had finally come and I had 2 weeks free from scientific work so I was able to focus on the smoke simulator.
I have made some huge changes in the whole code and rewritten most of it.
For now there are:

  • More readable code
  • Fix with the smoke emitter glitch when generating the smoke only on frame one
  • Some performance improvements
  • Easier user interface
  • Initial Fire+Smoke renderer (it does look terrible but I’m not as good in programing such staff)
  • Preparation in OpenVDB support
8 Likes

I’ve also started to learn blender addon creation.
Some test are shown below:

9 Likes

I’m happy to help with the bpy side of things, feel free to give me a ping :slight_smile: … although it looks like you won’t need any help!

1 Like