Liquids flowing throughout a pipe


I was wondering if anyone knows if it’s possible to use theejs to simulate a current of liquid through a pipe, in essence pipe flow. For simple liquids, so was thinking Newtonian incompressible fluids such as water.

I’ve only begun with threejs about a month ago and from what I gathered it appears that it’s doable, but not through threejs alone. That is, I can use C#/C++ to make e.g particles behave like this. I would tho like to do it in pure js/ts since I unfortunately don’t have the time to learn the C languages in the time needed to complete this.

Could anyone give me some advice on how to proceed? I was spontaneously thinking that generating particles and then using a useFrame() function to achieve this with numerical solutions to Napier stokes, but can’t seem to make my particles do anything basically.

Appreciate the help, and thanks for reading!

1 Like

Yup, exactly - three.js is not a simulation library, it’s just drawing 3D graphics. What three can do is render your simulation - but the simulation part you’d need to code yourself or use a specialised library to create it. It’s also a good idea not to bind one to another - data and rendering should run independently.

I applaud the initiative to start with one of the hardest simulation/rendering problems possible! :smiley:


1 Like

haha yeah Im starting to realize that too :sweat_smile:

Alright, that actually gives me an idea on how to implement it , thank you! :slight_smile:

1 Like

Wanted to thank everyone for their responses, and ask if anybody knows if its viable to use this setup:
React three fiber, I make a from Drei and then add a texture to this plane. Im thinking shaderMaterial or just a normal MeshBasicMaterial and then add a texture map for it.

On this texture I could now add GLSL to make it behave as liquid? That is, applying the Navier stokes numerical solutions via GLSL and do all the calculations in the GLSL, then just return the numerical values as a texture?