[Showoff Saturday] An experimental melting library for WebGL
![[Showoff Saturday] An experimental melting library for WebGL](https://preview.redd.it/rpvzl2rlq1ph1.gif?width=216&crop=smart&s=9e54e69f0f8d641c9ca82f32284974a85c46b416)
| 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. [link] [留言] |
原文:https://www.a8q9.cn/en/article/en-showoff-saturday-an-experimental-melting-library-for-webgl.html