Project:

Thought I would just give an update. I am able now to create fluid surface’s that are 3x greater than the previous version by making the vertex/index buffers static and updating via a texture in a custom vertex shader. The down side to is it can no longer be a and I have had to merge the code directly into the engine. (Seems you can’t use IMPLEMENT_VERTEX_FACTORY_TYPE from a as it has to have been initialized before Shader Core). Unless someone can tell me of another way. I won’t be releasing the code at the moment as its a little unstable, plus I want to add in compute shader support for the algorithm. should hopefully (Fingers crossed) allow surfaces up to 4096x4096 cells in size with little loss of speed.

Anyways here is a screenshot showing the current size I hit before slow downs occur:

Oooh wow very nice!

I really missed the fluid surfaces, I am glad you are bringing them back!

:slight_smile:

It’s hearing things like which make my day as a game developer. Well done.

Hi ,

Very cool progress!

RE: the IMPLEMENT_VERTEX_FACTORY_TYPE, you might be able to make another module in your with that code in it, and set the loading phase to “PostConfigInit”. I’m not sure if is early enough or not, but it’s much earlier than the default phase for modules.

Cheers,

Yes, it will work :slight_smile: “PostConfigInit” is good for custom shader .

Sweet I will try that out thanks, it’ll be good to be able to keep as a .

Thanks for picking up the torch, Can’t wait to play with it all :slight_smile:

No worries, it has been an exciting trip into the deepest and darkest sections of the engine, learning about the rendering. On that note I have created a Compute Shader and moved the simulation on to the GPU. Now I can create surfaces at 2048x2048 cells with very little performance hit. Thats about an 11x increase from the original if anyone is keeping score.

Oh wow!

!

!!!

Amazing work

You just made better than UE3 version (better at the very least cause its in UE4 hee hee)!

You just outperformed 's request!

:slight_smile:

Woah, that sounds amazing! I was actually about to ask if you had thought about going down that path :slight_smile: Do let me know if there is anything I can do to help get it into shape to review.

How are you doing collision at the moment? I would think just treating it as a thin box for collision purposes would be fine.

At the moment the code is very unoptimized and a mess, but afterwards I wouldn’t mind a review on the rendering process, like am I doing it correctly, or are there better ways, etc.

For now I have created an AggGeom box based on the bounds (Its about 5 or 10 units thick) which is used for tracing, otherwise I check overlapping actors per tick (Probably not very efficient).

Release v0.0.2

** Release v0.0.2**

Link: Fluid Surface v0.0.2

Version 0.0.2 has been released to . I have a new branch “” which contains the source code. You’ll need the following files/folders for it to work:

  • Engine/Plugins/Runtime//* - Main code
  • Engine/Shaders/FluidSurfaceShader.usf - Compute shader to perform simulation
  • Engine/Shaders/FluidSurfaceVertexFactory.usf - Vertex factory shader for rendering
  • Engine/Shaders/FluidSurfaceVertexFactoryCommon.usf - Common code for vertex factory
  • Engine/Shaders/FlatTessellation.usf - Had to make a small change to to allow the FluidSurfaceVertexFactory to modify the world displacement prior to the material (Will explain further down why)
  • Engine/Shaders/PNTriangles.usf - Same as above.

It is very important to get the shaders. The will not work without them.

The contains the following new features:

GPU based simulation
The simulation has moved from the CPU to a Compute Shader and vertex shader/domain shader additions. allows for larger areas to be calculated quicker. I have been able to run up to 2048x2048 tiles (About 491m wide with standard grid spacing) at realtime.

New tessellation modifications
If you enable tessellation, it will actually reduce the number of vertices/indices in needs to store in the buffers, and then uses the tessellation world displacement to offset the fluid surface (Rather than vertex world offset). It actually runs faster on larger surfaces to have tessellation enabled. New options have been added to the editor:

  • Build Tessellation data: will tell the component to use the new algorithm to build the surface. If you don’t apply a tessellation material, you will see a very low quality simulation, is because of the reduced triangle count.
  • Tessellation Ratio: allows you to tweak the amount of triangles to use for tessellation, the value can go from 0.1 - 2.0 (Max is twice the normal tessellated resolution, not recommended. The recommended value is 0.125)

As stated above, I had to add some code to both FlatTessellation.usf and PNTriangles.usf (So these are mandatory for execution) which can be found wrapped within the USE_FLUIDSURFACE macro to allow the Vertex factory to apply displacement prior to the material.

Release v0.0.2

** Release v0.0.3**

Link: v0.0.3

Version 0.0.3 has been released to . Moved pling calculations onto GPU and increased compute shader thread count. With tessellation and the right material setup, can now render 4096x4096 cells at realtime. Speed of all other cell counts should be increased.

Material used to blend tessellation by distance:

Credit goes to DaveTheFreak aka Scholze for the material setup. Can be found here Distance Based DX11 Tesselation - Video

Download link returns 404.

You need to be logged into your Git hub account to access it.

As per 's advise. I have moved the code to a new repository, it can now be located at <Link Removed>. All future updates will be to here.

UPDATE: Due to the fact that contains original code from the engine, I have removed the public repo. All future updates will remain in https://.com//UnrealEngine/tree/

Please refer to the following AnswerHub topic for information: https://answers.unrealengine.com/questions/40558/are-the-following-files-allowed-to-be-stored-in-a.html

I apologise for the confusion.

Absolutely great work , a great already and would really be awesome if integrated in ue4 (i think thats what is meant by pull request, im a bit of a noob when it comes to development nomenclature)

Does it work with 4.1.1? Because when I copied to my UE4 folder, when trying to generate visual studio project to compile the engine, I got many errors in CMD command.
Please an installtaion tutorial would be appreciated. Thanks.

Hi, I have had no issues running it with 4.1.1. Are you able to post some of the error messages? Also yes I am working on a more thorough installation tutorial, I will also provide some prebuilt binaries for the more common engine versions at some point.

When I put 4.1.1 files and everything required, then I place into /Engine/Plugins/Runtime directory and I place shaders into /Engine/Shaders directory
Then I compile, I get those errors:

Erreur 3 error : Failed to produce item: C:\UnrealEngine\Engine\Plugins\Runtime\CableComponent\Binaries\Win64\UE4Editor-CableComponent.dll C:\UnrealEngine\Engine\Intermediate\ProjectFiles\ERROR UE4
Erreur 2 error LNK1120: 1 externes non rÚsolus C:\UnrealEngine\Engine\Plugins\Runtime\CableComponent\Binaries\Win64\UE4Editor-CableComponent.dll UE4
Erreur 1 error LNK2019: symbole externe non rÚsolu “private: static class UClass * __cdecl UCableComponent::GetPrivateStaticClass(wchar_t const *)” (?GetPrivateStaticClass@UCableComponent@@CAPEAVUClass@@PEB_W@Z) rÚfÚrencÚ dans la fonction "public: class UCableComponent * __cdecl FPostConstructInitializeProperties::CreateDefaultSubobject<class UCableComponent,class UCableComponent>(class UObject *,class FName,bool,bool,bool)const " (??$CreateDefaultSubobject@VUCableComponent@@V1@@FPostConstructInitializeProperties@@QEBAPEAVUCableComponent@@PEAVUObject@@VFName@@_N22@Z) C:\UnrealEngine\Engine\Intermediate\ProjectFiles\Module.CableComponent.cpp.obj UE4
Erreur 4 error MSB3073: La commande “…..\Build\BatchFiles\Build.bat UE4Editor Win64 Development” s’est arrêtée avec le code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 UE4