How can I generate signed distance fields (2D) in real time, fast?
- by heishe
In a previous question, it was suggested that signed distance fields can be precomputed, loaded at runtime and then used from there.
For reasons I will explain at the end of this question (for people interested), I need to create the distance fields in real time.
There are some papers out there for different methods which are supposed to be viable in real-time environments, such as methods for Chamfer distance transforms and Voronoi diagram-approximation based transforms (as suggested in this presentation by the Pixeljunk Shooter dev guy), but I (and thus can be assumed a lot of other people) have a very hard time actually putting them to use, since they're usually long, largely bloated with math and not very algorithmic in their explanation.
What algorithm would you suggest for creating the distance fields in real-time (favourably on the GPU) especially considering the resulting quality of the distance fields?
Since I'm looking for an actual explanation/tutorial as opposed to a link to just another paper or slide, this question will receive a bounty once it's eligible for one :-).
Here's why I need to do it in real time:
There's something else: