[Showoff Saturday] An experimental melting library for WebGL

Still work in progress. It is originally created for the browser game I'm working on but decided to publish it as a standalone library. There's different presets aswell, like Tar, Chocolate, Wax, Honey, Solder etc.

The picture gets treated as a body of material and run through a 2D free surface Navier-Stokes solver on the GPU. Temperature drives viscosity across about four decades, so the same code covers a solid that barely creeps and a liquid that runs off the screen. The outline of the picture is a level set the solver actually solves for, which is why drops swell, neck and detach on their own instead of just stretching. The image itself rides on a reference map, a second field that stores where each cell started, so it deforms with the material instead of turning to mush from repeated resampling.

You can check the source code @ https://github.com/1etu/MeltGL and the live demo @ https://1etu.github.io/MeltGL/

Still working on the polishing and an ability to melt DOM elements.

submitted by /u/etulastrada
[link] [留言]