I was inspired by @RyanB GDC talk and made my 2d fluid sim as a coffee break project. It is pretty cool, but I ran into several issues.
**1) Bounds. **
If I understood the paper](http://http.developer.nvidia.com/GPUGems/gpugems_ch38.html) correctly, it is proposed to have a bounds texture, that stores offset to the closest pixel inside.
This texture is sampled once per stage and the result is added to UVs that are used throughout the stage.
Then for pressure, value just inside the border is used as is, and for velocity, the value is inverted.
My first complication is how to efficiently apply it to borders of arbitrary shape(or to be more precise, how to efficiently generate a texture, that stores offset to the closest pixel inside or outside of the border) ?
And the second issue here is how to deal with moving bounds. Simply having moving objects looks surprisingly acceptable, but they tend to eat up fluid instead of displacing it.
Injecting some of the velocity from moving object into velocity texture helps, but it is still quite fake.
I Imagine that velocity change should be a function of existing velocity, moving object’s surface normal and moving object’s velocity.
I’m frankly not sure how to implement that, while maintaining moving object’s boundaries(and do we need boundary condition for moving object at all, provided that we are doing velocity change? ).
After seeing fluid sim in action, I’m quite eager to extend what I have a to a system for baking FX into flipbooks.
It is possible to loop the animation by blending two flipbooks with an offset in time, but is there a way to loop the sim itself?
Thanks for any assistance rendered in advance.