Realtime GPU smoke simulation

While I’d love to finally have usable fluid simulation system in Blender, unlike mantaflow, AFAIK the plan for the next fluid dynamics solver in Blender is to be implemented through the geometry nodes, or perhaps some new simulation nodes. So I am not sure as soon as possible is the best timeframe to do this one. If it was integrated the same way as mantaflow is, then it’d be either throwaway work, or we’d have two different places to do the fluid dynamics in Blender, which would be very poor from the UX standpoint.

3 Likes

As a side project I’m working on the node GUI so this is definitelly the way to go, however I’ll wait some time to see where the simulation nodes will go

8 Likes

The principal reason is the performance… i thinks is better if the communication are inside the source code than a 3rd app

you’d be incorrect, addons can have great performance, don’t get me wrong i’d rather see it in core as well, but it doesn’t need to be, it can be an addon.

3 Likes

Point in case: UVPackmaster is an Addon, where the external .exe is being called by the Blender Plugin and it fast as hell! The plugin is also being sold for other 3D software with bridge plugins but aside from having to set up an external path and a separate download for the application (because GPL and such) you’d never realize that it’s an Addon, really.

1 Like

In this case, native integration could have significant performance benefits. In principle you could do simulation on the GPU and then have Eevee/Workbench use that data on the GPU directly for display in the viewport, without a roundtrip through the CPU.

24 Likes

The point i was making @Stimes claimed it must be in the blender core, it’s the only way. which it isn’t, good perf can be had from addons, sure there’s definite benefits having it in the core (and like i said i’d love see it in the core but there’s no reason that it must be there), but even there at a sim-rate in the hundreds of ms/frame skipping a cpu roundtrip will certainly help, but it’ll unlikely be significant savings compared to the sim and render costs.

5 Likes

For a beginning yes… but for the long term is better in the kernel.

1 Like

Yes it’s exactly what i said ^^ in source code from blender is better thank you Brecht

1 Like

The addon part is more for the beginning as I’m not as familiar with blender core. Also it’s much faster to develop and compile.
But later I’ll consider total integration

21 Likes

So during last week I’ve been working on neural engine for JFlow and the first step was to upscale rendered images for shorter high resolution render times.
In this video the speed up was around 3x vs native 4K rendering

25 Likes

Would be great to have such AI upscaling technique inside blender renderers in general.

5 Likes

Hmm. That’s not such a bad idea. I could try to do it in the meantime. However that would probably require a bit more research as this AI was made as a proof of concept for now in around 2 days.

9 Likes

How about AI to upscale actual volumetric grids? There are quite a few image upscaling algorithms already out there, so I am not sure it makes sense to reinvent the wheel. Volumetric grids on the other side, that could be interesting. The best we have so far is just wavelet noise. I think it would be really cool to have machine learning model, which would take low res volumetric grids and at least double their resolution in all 3 dimensions.

Rendertimes aren’t that much of an issue these days, but simulation times still are. And there’s also that annoying stereotype of simulating a lowres grid to find the simulation shape you like, just for it to end up completely different if you half the voxel size. The AI model could serve as a “I like the way this looks, I just want more detail” kind of button, but without the generic wavelet noise visual tradeoff :slight_smile:

7 Likes

Shhhh, not that loud :wink: . But honestly it was the main plan when implementing Neural Engine inside JFlow. I also have some ideas how to do this, as AI Research is my main job. It’s just quite hard and computationally heavy so I’ll have a lot of work to optimize it. But it is planned.
That’s also why I’ve tried first 2D upscaling as it’s much simpler for a concept.
Also I didn’t use third party AI upscaling models as they were much slower than my model and the only reason it is as a feature is that I wanted faster 4K renders than with native rendering. ESRGAN etc. just took too long to compute

18 Likes

I’ve been thinking, that since most of the fluid simulators suffer from the issue of the grid resolution changing the outcome (shape and look) of the simulation, a good idea for a dataset for a hypothetical AI model could be just simulating a bunch of different high res simulations as output/result training data, and their respective inputs being the very same simulations, just for example each 2nd or 4th voxel. So the low res input sample would be synthetic, downsampled version of the high res output sample. With such training data set, I’d expect the resulting network being really good at keeping the simulation shapes nearly identical, just more detailed. This could also save some time and effort generating the training set.

I don’t do any AI research or programming, but I thought it could be a good idea. Maybe it’s a common approach everyone knows already, and I’ve just reinvented a wheel :slight_smile:

5 Likes

Don’t worry and thanks for help. Yes, it is a common technique and that’s exactly what I’m doing right now but good job with coming with such idea yourself :smiley: .
The good thing is that with current JFlow generating high-res simulations is a matter of minutes so there shouldn’t be problem with the generation itself, but the bad thing is handling such amounts of data during the training and in terms of hard-drive space.

Anyways I’ll experiment with different techniques and hopefully come up with something performant and good looking.

7 Likes

Cycles render preview. Later there will be probably an animation but it takes ages in 4K (around 4minutes/frame)

29 Likes

Aaaand there it is. A Cycles render. It was rendered in around 720p and then upscaled to 4k with the custom AI model as a test.

34 Likes

Wow man, as i can only script a bit, it blows my mind, that you can do all that stuff. Physics, AI and so fast. I really hope you might end up as blender dev. That would be awesome ! Is the upscaling done in a separate program ?

5 Likes