Hi,

I've been trying to convert my simple 2D fluid solver to a liquid solver with a free surface. For that I've introduced the level set method into the application. However, I seem to be losing mass/volume at a ridiculous speed. Here are two videos showing exactly what I mean: I switch between rendering the advected color vector and the the level set where phi < 0 (i.e. the inside of the liquid, rendered as black).

https://www.dropbox.com/s/qz7ujya1oyommls/levelset0.mp4?dl=0

https://www.dropbox.com/s/g2pzl121sp9td6g/levelset1.mp4?dl=0

From what I've read from the papers, the problem is that after advection, phi doesn't hold the signed distance anymore and needs to be reinitialized. However, I've got no idea how one would do it. Some papers have mentioned fast marching method but from what I can understand, it doesn't suit well for GPUs (my solver is completely GPU based). Some other papers mentioned Eikonal solvers in their references but I literally have no idea what/how to proceed.

Any help would be greatly appreciated: bonus points if anyone can link to a tutorial/instructional text that isn't a high-level implementation paper glancing over details.

Here's how I've defined the signed distance initially:

float2 p = input.position.xy - pointCenter; float s = length(p) - radius; return float4(s, s, s, 1.0f);