# Physics Forests - A New Real-time Fluid Solver - Download demo NOW!

**URL:** <https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343>\
**Category:** Game Development\
**Tags:** unreal-engine\
**Created:** [April 5, 2017, 9:49pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343 "2017-04-05T21:49:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 5, 2017, 9:49pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/1 "2017-04-05T21:49:39Z")

</div>

We are developing a new fluid solver using machine learning, capable of simulation large simulations (for foam-less fluid ~10 million, with foam a bit less) with surface generation, rigid body coupling, multi-phase and rendering in real-time. The quality-running time trade-off is controllable.

Recent simulations:

SIGGRAPH 2017 Real-time Live submission video :

The method is perfectly stable in any circumstances, including when the incompressibility constraint can not be fully satisfied (non-simulated objects squash the water etc).

We developed the alpha version of a plugin for UE4, mainly for designing purposes, but if there is any interest in the game development community, we can work on it a bit more to make it releasable. Based on my knowledge, a typical games give only several milliseconds per frame to a physics engine, and mostly only on CPU. We haven’t optimized our method much (it’s simply a basic vanilla implementation), so there is a large space for improvement (my guess is that 5x should be achievable). Also several approximations (height map and low precision/skip calculations outside of the region of interest) are possible, however 3ms on CPU with current hardware seems out of reach.

If anyone’s interested in our project, or is able to provide us some example scenario from UE4 with a lot of water, so that we can optimize an algorithm for a particular scenario, please send me a message or write a comment below.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0e02c017](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0e02c017](https://forums.unrealengine.com/u/anonymous_user_0e02c017)\
**Post date:** [April 6, 2017, 2:32pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/2 "2017-04-06T14:32:40Z")

</div>

It looks great but I want some actual performance numbers. Because everything beautiful costs a lot.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 6, 2017, 2:56pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/3 "2017-04-06T14:56:01Z")

</div>

All videos are actual real-time recordings with NVIDIA ShadowPlay. The number of fluid particles, foam particles and per frame running time in shown in each video at the bottom.

In the fastest setting:

1. 10M particles run in real-time
2. foam decreases the performance by maybe 20-30%
3. multiple fluids are a bit slower (we improved by maybe 30% since we recorded that video)
4. particle rendering (sand) is slower than surface (water), dust(rendered as smoke) rendering is much slower
5. rigid bodies are not optimized yet and for example in the last duck video they take ~10ms per frame

All videos were recorded on TitanX, some of them run faster than the other, because we used different setting.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0e02c017](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0e02c017](https://forums.unrealengine.com/u/anonymous_user_0e02c017)\
**Post date:** [April 6, 2017, 3:03pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/4 "2017-04-06T15:03:04Z")

</div>

Cool I’ll keep an eye on this.

---

<div class="post-metadata">

**Author:** ![WixZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WixZ](https://forums.unrealengine.com/u/WixZ)\
**Post date:** [April 6, 2017, 3:46pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/5 "2017-04-06T15:46:36Z")

</div>

This is incredible. One step closer to real-time fluid simulations in games. I could think of a hundreds of possible game ideas with this. But the problem I would see is unpredictability. Which is nice of course, but it could be hard to make “fair” games with this as there are so many variables to factor in. But some basic physic based games could be very fun. Maybe even like a waterslide game or wild river game where you have to avoid obstacles and such. But then you’d have to add something that only fluid simulations can give, because otherwise it’s a bit overkill. xD

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [April 7, 2017, 12:50am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/6 "2017-04-07T00:50:12Z")

</div>

> [@lubor\_;691204](#):
>
> We are developing a new fluid solver using machine learning, capable of simulation large simulations (for foam-less fluid ~10 million, with foam a bit less) with surface generation, rigid body coupling, multi-phase and rendering in real-time. The quality-running time trade-off is controllable.

It looks really awesome, could you show how it looks like with a quite low res so that the performance impact is only something like 3 ms? Does it scale linearly with the particle amount, so will 100 times less particles run 100 times faster? In games you often don’t need super high accuracy.

> [@lubor\_;691204](#):
>
> Based on my knowledge, a typical games give only several milliseconds per frame to a physics engine, and mostly only on CPU. We haven’t optimized our method much (it’s simply a basic vanilla implementation), so there is a large space for improvement (my guess is that 5x should be achievable). Also several approximations (height map and low precision/skip calculations outside of the region of interest) are possible, however 3ms on CPU with current hardware seems out of reach.

Why do you mention the CPU here? Isn’t the fluid sim only heavy on the GPU?

Also, you mention CUDA, if you want this to be usable in games you should make it use OpenCL, direct compute or vulkan compute so that it runs on AMD and Intel GPUs too, for now direct compute is probably the best.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 7, 2017, 1:08am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/7 "2017-04-07T01:08:38Z")

</div>

> [@Alcatraz;691815](#):
>
> Does it scale linearly with the particle amount, so will 100 times less particles run 100 times faster? In games you often don’t need super high accuracy.

In practice the behavior is close to linear in a range 10k-100M. (at ~120M we run out of 8GB GPU memory). It is slightly sublinear up to 1M particles, and slightly superlinear from 5M. So if particles were twice the size in every dimension, it would be approx 8x faster and might fit into those 3ms.

> [@Alcatraz;691815](#):
>
> Why do you mention the CPU here? Isn’t the fluid sim only heavy on the GPU?

Typically physics library (Havok for example) runs only on CPU. Getting GPU computing power in AAA games except for rendering might be impossible. I hope this will change in the future:)

> [@Alcatraz;691815](#):
>
> Also, you mention CUDA, if you want this to be usable in games you should make it use OpenCL, direct compute or vulkan compute so that it runs on AMD and Intel GPUs too, for now direct compute is probably the best.

We have an OpenCL version too (which was our original implementation), we switched due to better debugging tools for CUDA. We will consider other platform after we progress a bit further with the development.

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [April 7, 2017, 1:17am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/8 "2017-04-07T01:17:05Z")

</div>

> [@lubor\_;691822](#):
>
> In theory it scale linearly, in practice the behavior is close to linear in a range 10k-100M. (at ~120M we run out of 8GB GPU memory). So if particles were twice the size in every dimension, it would be approx 8x faster and might fit into those 3ms.

That sounds nice.

> [@lubor\_;691822](#):
>
> Typically physics library (Havok for example) runs only on CPU. Getting GPU computing power in AAA games except for rendering might be impossible. I hope this will change in the future:)

I don’t quite follow your here. As you said below the fluid sim can run either on CUDA or on OpenCL, which is both GPU. So if you run this, then it will take GPU time, not CPU time. You are saying “Getting GPU computing power …] might be impossible”, but its exactly what you are doing as far as I can tell, so it doesn’t make any sense to me what you say here?

> [@lubor\_;691822](#):
>
> We have an OpenCL version too (which was our original implementation), we switched due to better debugging tools for CUDA. We will consider other platform after we progress a bit further with the development.

Great!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 7, 2017, 1:40am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/9 "2017-04-07T01:40:04Z")

</div>

> [@Alcatraz;691828](#):
>
> You are saying “Getting GPU computing power …] might be impossible”, but its exactly what you are doing as far as I can tell, so it doesn’t make any sense to me what you say here?

Yes, you are right. I should have skipped all that nonsense:). I just wanted to say there is no way we get it working in 3ms on this scale on CPU (we had such offers).

---

<div class="post-metadata">

**Author:** ![Frenetic\_Pony](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Frenetic\_Pony](https://forums.unrealengine.com/u/Frenetic_Pony)\
**Post date:** [April 7, 2017, 2:10am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/10 "2017-04-07T02:10:13Z")

</div>

Saw the papers on this last year(ish?) very cool to see it just brought to a plugin and etc.! I’m curious, what’s the deployment of the neural network like in terms of inference bit depth? Can you go through the built trees in 8bit like I’ve seen others?

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [April 7, 2017, 6:54am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/11 "2017-04-07T06:54:17Z")

</div>

> [@lubor\_;691835](#):
>
> Yes, you are right. I should have skipped all that nonsense:). I just wanted to say there is no way we get it working in 3ms on this scale on CPU (we had such offers).

I would think that everyone knows that doing this in 3 ms on a CPU is absolutely not possible :rolleyes:

You say you might be able to make it 5 times faster, if you then double the particle size and that makes it 8 times faster, then that means its 40 times faster. That means all of your demos would run at way less or slightly above 1 ms, which would be super fine in a game. Now these numbers are Titan X, so something like 2 or 3 ms on a 970 is still great.

If it really works out like that, I definitely see this being used a lot. Sounds a bit too good to be true though actually 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 7, 2017, 10:33am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/12 "2017-04-07T10:33:43Z")

</div>

> [@Frenetic Pony;691847](#):
>
> I’m curious, what’s the deployment of the neural network like in terms of inference bit depth? Can you go through the built trees in 8bit like I’ve seen others?

we don’t use NN, we use our own variant of regression forests with max depth 20

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 7, 2017, 10:52am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/13 "2017-04-07T10:52:50Z")

</div>

> [@Alcatraz;691904](#):
>
> If it really works out like that, I definitely see this being used a lot. Sounds a bit too good to be true though actually 🙂

the factor you did not include in your calculation is the size of the simulation, which would typically be a bit bigger than in our videos

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7f98bbe1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7f98bbe1](https://forums.unrealengine.com/u/anonymous_user_7f98bbe1)\
**Post date:** [April 7, 2017, 12:58pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/14 "2017-04-07T12:58:38Z")

</div>

That simulation looks amazing!  
As for interest in the game development community, here are a bunch of things that would be cool to have:

1. Blueprints integration. Would be kinda cool to be able to attach fluid emitter to movable BP actor, be it a weapon or just a fluid container.
2. Flooding simulation and water resistance. I work on game with underwater vehicles in it, and I had to simulate underwater movement by making a 6-axis zero gravity vehicle. One hell of workaround that requires a lot of additional parameters to look right. The very fact that you have a working buoyancy already makes me happy, but it would be even more cool if it would be possible to tweak buoyant actor sinking, ideally with visual flooding inside the mesh or without it by just tweaking parameters.
3. Wave generator.
4. Ability to make unlimited distance water pool with blueprint actor.
5. Cut out zones in fluid surface for objects/landscape placement  
Will keep an eye on this thread, in current state imo this simulation looks better than the vast majority of currently existing solutions. I know it is probably a bit too early to ask, but I assume you targeting unreal marketplace with this thing, so I would like to know about theoretical pricing for final version.  
Anyway, keep up the good work, this is just incredible.

---

<div class="post-metadata">

**Author:** ![teak421](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/teak421/32/902996_2.png) [@teak421](https://forums.unrealengine.com/u/teak421)\
**Post date:** [April 7, 2017, 3:03pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/15 "2017-04-07T15:03:23Z")

</div>

Looks like some Houdini type sims… Very nice!

teak

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 7, 2017, 3:32pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/16 "2017-04-07T15:32:04Z")

</div>

> [@;692022](#):
>
> 1. Blueprints integration. Would be kinda cool to be able to attach fluid emitter to movable BP actor, be it a weapon or just a fluid container.

We started implementing unreal plugin only ~2 weeks ago, so far we are able to visualize the result, but the simulation is defined outside of unreal. We plan to do a full integration within a few weeks. Attaching the source to a movable BP actor should not be a problem; from the simulation point of view it is the same as in that teddy bear video, where we controlled the emitter by the mouse.

> [@;692022](#):
>
> 1. Flooding simulation and water resistance. I work on game with underwater vehicles in it, and I had to simulate underwater movement by making a 6-axis zero gravity vehicle. One hell of workaround that requires a lot of additional parameters to look right. The very fact that you have a working buoyancy already makes me happy, but it would be even more cool if it would be possible to tweak buoyant actor sinking, ideally with visual flooding inside the mesh or without it by just tweaking parameters.

It should be already possible, all these tweaking parameters are already there.

> [@;692022](#):
>
> 1. Wave generator.

that should be possible with a small additional external force (slight modification to what was used in the last dust video in “various materials”)

> [@;692022](#):
>
> 1. Ability to make unlimited distance water pool with blueprint actor.

I don’t fully understand this request. Unlimited simulation would be possible only if we simulate the water only in some region of interest and elsewhere it would be governed by a wave equations. We plan to work on various approximation methods like this in the near future.

> [@;692022](#):
>
> 1. Cut out zones in fluid surface for objects/landscape placement

That can be already done and it was used for example in the sandcastle scene.

> [@;692022](#):
>
> I know it is probably a bit too early to ask, but I assume you targeting unreal marketplace with this thing, so I would like to know about theoretical pricing for final version.

It is a bit too early, it will depend on the interest and on what will our plugin eventually include. We also work on a few other applications of our method (so far in the released videos both acceleration prediction and surface generation are done using machine learning), we will release videos when we are happy with the quality.

---

<div class="post-metadata">

**Author:** ![John\_Alcatraz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@John\_Alcatraz](https://forums.unrealengine.com/u/John_Alcatraz)\
**Post date:** [April 7, 2017, 4:31pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/17 "2017-04-07T16:31:17Z")

</div>

> [@;692022](#):
>
> in current state imo this simulation looks better than the vast majority of currently existing solutions. I know it is probably a bit too early to ask, but I assume you targeting unreal marketplace with this thing, so I would like to know about theoretical pricing for final version.

If they get this to a state where its usable in many games, I would definitely advise against putting it on the marketplace. They should go the more common middleware way of doing custom licensing, with options for indies and for AAA. There would definitely be big companies interested in this, and those are willing to pay a lot more than indies.

I would suggest doing it like InstaLOD does: [http://www.instalod.io](http://www.instalod.io)

An indie version for something like $79 and custom licensing for bigger companies 🙂

---

<div class="post-metadata">

**Author:** ![Callipark](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Callipark](https://forums.unrealengine.com/u/Callipark)\
**Post date:** [April 8, 2017, 6:37pm UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/18 "2017-04-08T18:37:02Z")

</div>

I can see this being very useful for making offline simulated assets, like realistic looking riverbeds with pre-simulated water flow.

Although Real-time fluid simulation in AAA titles might be a few years out in terms of hardware, having a user-friendly way to create water flows & structures that have been baked for placement in static worlds would have a variety of applications and presumably be vastly more performant than a real time simulation.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3375a5e9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3375a5e9](https://forums.unrealengine.com/u/anonymous_user_3375a5e9)\
**Post date:** [April 9, 2017, 12:38am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/19 "2017-04-09T00:38:27Z")

</div>

> [@;692596](#):
>
> Although Real-time fluid simulation in AAA titles might be a few years out in terms of hardware, having a user-friendly way to create water flows & structures that have been baked for placement in static worlds would have a variety of applications and presumably be vastly more performant than a real time simulation.

The technology development is in a very early stage and so far we just tried to figure out the right setting, such that the simulation looks reasonable, can handle interactions (so far rigid bodies, but in principle the method can be similarly combined with other kinds of objects) and can generate surface. I’m aware that the technology is not practically useful yet as it is, but there is a large space for improvement not only by raw optimization of the GPU code, but also by simulating a different level of details depending on the distance from the camera (either using height map, wave equations for ocean, varying sized particles, …) . All these tricks would cause stability problems in our methods, but our regressor would be just fine with that. Basically, it should be possible to run arbitrary large scene with only 1M predictions per frame. But all the tweaking and optimization will take some time.

The main reason we advertised our method was to get some feed-back from the people from the field, and potentially get some assets/designed scenes to tune all these LOD hacks (so far that doesn’t seem that easy). It might be too early for our method even after we do all the things we plan, but I just case how this would be the case in 5 years.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ac05b72b1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ac05b72b1](https://forums.unrealengine.com/u/anonymous_user_ac05b72b1)\
**Post date:** [April 9, 2017, 6:45am UTC](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343/20 "2017-04-09T06:45:05Z")

</div>

> [@lubor\_;691204](#):
>
> If anyone’s interested in our project, or is able to provide us some example scenario from UE4 with a lot of water, so that we can optimize an algorithm for a particular scenario, please send me a message or write a comment below.

an ocean.

a mountain river coming down to plains where it starts meandering.

water and sand interaction

just to mention 3 things i would use this for. If i could.

[Next page](https://forums.unrealengine.com/t/physics-forests-a-new-real-time-fluid-solver-download-demo-now/89343.md?page=2)
