How to export fluid animation to gltf

I want to make an animation of a coffee machine in Babylon. I have done the animation in Blender, including pressing the button, twisting the handle, etc., but the animation of the coffee flowing into the cup cannot be exported correctly

i’ll CC @PatrickRyan but I’ll also say - there is some information missing before anyone could help. what does it mean “cannot be exported correctly”? is there an error when exporting? when loading? what exporter are you using?

First thanks for your help, I use Blender create a coffee machine and export it as glFT by Blender too. Other animations such as translation and rotation can be displayed and controlled normally in Babylon. But the animation of simulating fluid (the process of injecting coffee into the cup) cannot be displayed. Instead, it is a brown cube, which is the scope of the fluid in the modeling process.

You can not export fluid simulations to .glb format in its current state. I think it has to do something with .glb does not support generation of new vertices.

You can post a feature request in the official Github issue here glTF roadmap - what would you like to see next in glTF? · Issue #1051 · KhronosGroup/glTF · GitHub

If anyone has any workarounds or faux methods to achieve a “fluid filling effect” I’m also interested.

@yifei_xu, I agree with @Horisonten that your main obstacle here is that glTF will not support this kind of vertex animation in its current form. The best option for you is morph target animation mixed with some animated UVs.

If you are able to take a few poses of your simulation and bake the vertex positions to the mesh, you can create several morph targets, called shape keys in Blender and simply animate the influences between them to fake the simulation.

For the animated UVs, if you want to reinforce the idea that it is liquid flowing, you could create base color and normal textures with things like air bubbles or complex surface normals showing how the liquid is moving as it flows. Make sure it is tiles correctly and then you could either animate the UVs of the texture along the surface, or you could do a UV projection using the camera’s view angle to map it onto the liquid surface like we did in this triplanar projection example.

I hope this helps you frame your solution, but please feel free to ping back with more questions.

Thanks a lot, your answer is very helpful, then I know what should I do next.

thanks, I will try your method. At present, my idea is to use a cylinder to represent the water flow and a cylinder to represent the coffee in the cup, which is produced by growing animation. Of course, it will be more difficult to simulate the ripple in this way

1 Like