{"id":65,"date":"2009-01-24T18:34:52","date_gmt":"2009-01-24T16:34:52","guid":{"rendered":"http:\/\/blog.ansuz.nl\/?p=65"},"modified":"2009-01-24T18:35:24","modified_gmt":"2009-01-24T16:35:24","slug":"metaballs","status":"publish","type":"post","link":"http:\/\/blog.ansuz.nl\/index.php\/2009\/01\/24\/metaballs\/","title":{"rendered":"Metaballs"},"content":{"rendered":"<p>This week I&#8217;ve been working on creating a liquid effect in Flash. After a little research and a relapse to my got old 3D days I remembered a principle called &#8216;<a href=\"http:\/\/en.wikipedia.org\/wiki\/Metaballs\" target=\"_blank\">Metaballs<\/a>&#8216; or &#8216;<a href=\"http:\/\/en.wikipedia.org\/wiki\/ISO_surface\" target=\"_blank\">Iso surfaces<\/a>&#8216;. This is a nice way to replecate fluid dynamics in a 2D or 3D environment. So after some web browsing I found a nice implementation in AS3 by <a href=\"http:\/\/blog.szataniol.pl\/?p=28\" target=\"_blank\">Szataniol<\/a>. The only problem with this implementation was that it lacked alpha, which I needed to be able to apply some filters for a more realistic effect. This was easily solved by adding an extra render pass to calculate the mask. I&#8217;ll post the code for that below.<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_bucket_debug.swf\" target=\"_blank\"><img decoding=\"async\" src=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs.jpg\" alt=\"\" \/><\/a><\/p>\n<p>I hooked up the &#8216;renderer&#8217; from Szataniol to the Box2D physics engine and starting messing around. I ended up making a couple of different versions:<\/p>\n<ul>\n<li><a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_spray.swf\" target=\"_blank\">Splash<\/a><\/li>\n<li><a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_obstacles.swf\" target=\"_blank\">Obstacle course<\/a><\/li>\n<li><a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_bucket.swf\" target=\"_blank\">Fixed shape<\/a> (<a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_bucket_debug.swf\" target=\"_blank\">with debug draw<\/a>)<a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_bucket.swf\" target=\"_blank\"><br \/>\n<\/a><\/li>\n<li><a href=\"http:\/\/ansuz.nl\/toys\/metaballs\/metaballs_blobs.swf\" target=\"_blank\">Blob<\/a><\/li>\n<\/ul>\n<p>I&#8217;ve set up my Main class in such a way that I can easily switch settings to create the different effects by using a different Model class.<\/p>\n<p>[insert class diagram&#8230;]<\/p>\n<p>TBC&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>This week I&#8217;ve been working on creating a liquid effect in Flash. After a little research and a relapse to my got old 3D days I remembered a principle called &#8216;Metaballs&#8216; or &#8216;Iso surfaces&#8216;. This is a nice way to &hellip; <a href=\"http:\/\/blog.ansuz.nl\/index.php\/2009\/01\/24\/metaballs\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[140,139,63,62],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-actionscript-30","tag-actionscript","tag-actionscript-30","tag-iso-surfaces","tag-metaballs"],"_links":{"self":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":0,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}