🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Unreal Engine 5 -- fluids

Started by
5 comments, last by taby 1 year, 6 months ago

Posted on forums.unrealengine.com:

There is transform feedback in OpenGL 4. This includes feedback from the vertex shader or the geometry shader. Is there a way to obtain the 3D texture that is generated and used by the fluid solver? I would like to run it through Marching Cubes (in a geometry shader, preferably), to generate an isosurface, and then use that isosurface to do collision with the actors. An example would be a space ship shoot em up (shmup), where we totally rip off Blazing Lazers for TG16, and have giant screen-filling special effects that not only look beautiful, but are deadly too. This game would use an orthographic camera, instead of a perspective camera, so that way the one, unified, fluid sim bounding box can be equal to the region between the near and far planes. If the view was based on a perspective frustum, a lot of the sim bounding box would not be in the view, which is kind of like wasting cycles. Thanks for any advice that you have.

Of course, the project will be open source, and free to play/modify. I want people to learn from my experiences with UE5.

Want to steal my ideas? Please, go ahead! Just put your solution up on YouTube.

Perhaps I'm going at this all wrong?

Advertisement

taby said:
I would like to run it through Marching Cubes (in a geometry shader, preferably), to generate an isosurface, and then use that isosurface to do collision with the actors.

Not sure if that's a good idea. Basically you turn a volume grid which is ideal O(1) to query spatially, into a mesh which is worst case O(n). Physics engines usually generate a BVH from triangles so they can find them spatially at least in O(log n), but that's meant for static meshes.

So the better idea would be to use the fluid volume directly for collisions. Physics Engines often support this. PhysX (used in UE4, but not sure about 5) does afaict. Not sure if such features are exposed to UE or how, though.

Particle based fluid simulations is another story. MPM uses a mass volume at least, SPH only bins particles to grid cells to get spatial queries.
But no matter what, you could always generate a density volume easily, which you need for Iso Surface anyway.

I assume UE gives some options to interact with fluid, e.g. such density volume or velocity vector fields. Maybe it's easier to find after you exclude transform feeback or iso surface from your searching. Neither is needed.
OGL feedback is useful to get results from vertex shader processing, but for fluid sim you would use compute, so data can be downloaded to CPU as is.

Looking up the Asset Store might also show some nice fluid sim solutions.

Thanks once again for your insight. Yes what I’m looking for can be solved using 3D texture sampling.

Found this in the docs:

Collide Against
You can have your simulation react to actors in your level.

Does not mean it works the other way around too, though.

Yes sir, one adds the collider tag to an actor for it to interact with the simulatior.

I made a blog post about Niagara fluids:

https://cowcow1977.art.blog/2022/12/17/how-to-create-fire-smoke-from-scratch-in-niagara-unreal-engine-5-1/

This topic is closed to new replies.

Advertisement