{"assets":[],"author_link":"author\/danvil\/","author_name":"Danvil","cat":"LD #24","categories":["LD #24"],"comments":[],"epoch":1347440400,"event":"LD24","likes":9,"metadata":{"p_key":"78223","p_author":"Danvil","p_authorkey":"0","p_urlkey":"287233","p_title":"LD 24: Creating procedural critters","p_cat":"LD #24","p_event":"LD24","p_time":"1347440400","p_likes":"9","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1345766400","event_key":"12","event_name":"LD24"},"source_url":"2012\/09\/12\/ld-24-creating-procedural-critters\/","text":"<p>How do you create theses insect\/plant like critters<\/p>\n<p><img alt=\"Critters\" src=\"http:\/\/content.wuala.com\/contents\/Danvil\/Public\/LD24\/Critters\/critter_montage.png\"\/><\/p>\n<p>from these basic shapes?<\/p>\n<p><img alt=\"Base\" src=\"http:\/\/content.wuala.com\/contents\/Danvil\/Public\/LD24\/Critters\/base_montage.png\"\/><\/p>\n<p>That was the question I posed myself for the Ludum Dare 24 compo. The theme was evolution and I wanted to create some little critters which could change there appearance smoothly.<\/p>\n<p>The basic shapes you see above can be easily described using <a href=\"http:\/\/en.wikipedia.org\/wiki\/Polar_coordinate_system\" target=\"_blank\" title=\"Wikipedia: Polar coordinate system\">polar coordinates<\/a>.<\/p>\n<p>Polar coordinates express a 2D curve in the form r(t). For each angle t the function r(t) gives the radius at this angle. Here are the definitions of the simple shapes above:<\/p>\n<ul>\n<li>Sphere: r(t) = 1 (a circle has constant radius)<\/li>\n<li>Star: r(t) = r0 + (1-r0)*(1-abs((n*t mod 2 pi)\/pi-1))^p. This is a bit complicated \u2013 I could not find an easier definition. n is the number of star corners and r0 and p are additinal parameters.<\/li>\n<li>Rose: r(t) = cos(n*t), where n is the number of rose petals.<\/li>\n<li><a href=\"http:\/\/en.wikipedia.org\/wiki\/Cardioid\" target=\"_blank\" title=\"Wikipedia: Cardioid\">Cardioid<\/a>: r(t) = 1 + cos(t + pi). This is a funny mathematical object.<\/li>\n<\/ul>\n<p>Now how do we get the complex shapes? Easy: they are formed buy just using a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Linear_combination\" target=\"_blank\" title=\"Wikipedia: Linear combination\">linear combination<\/a> of the simple shapes.<\/p>\n<p>For example we use the two simple shape functions r_star(t) and r_cardioid(t) and form the linear combination r(t) = a*r_star(t) + b*r_cardioid(t). Using a and b equal to 0.5 yields the third shape you can see above.<\/p>\n<p>You can <a href=\"http:\/\/content.wuala.com\/contents\/Danvil\/Public\/LD24\/Blobs\/index.html\" target=\"_blank\" title=\"LD24: Critter Generator\">use my critter generator to create your own critters<\/a>.<\/p>\n<p>Also, <a href=\"http:\/\/www.ludumdare.com\/compo\/ludum-dare-24\/?action=preview&amp;uid=5851\" target=\"_blank\" title=\"LD 24: Evolution by Danvil\">play and rate<\/a> my compo entry!<\/p>\n<p>Tags: <a href=\"http:\/\/www.ludumdare.com\/compo\/tag\/compo\/\" rel=\"tag\">compo<\/a>, <a href=\"http:\/\/www.ludumdare.com\/compo\/tag\/post-mortem\/\" rel=\"tag\">post-mortem<\/a>, <a href=\"http:\/\/www.ludumdare.com\/compo\/tag\/postmortem\/\" rel=\"tag\">postmortem<\/a>, <a href=\"http:\/\/www.ludumdare.com\/compo\/tag\/techniques\/\" rel=\"tag\">techniques<\/a>, <a href=\"http:\/\/www.ludumdare.com\/compo\/tag\/unity3d\/\" rel=\"tag\">unity3d<\/a><\/p> <div style=\"float: right;border: 1px solid #eee;padding: 2px;background: #fff;\"><div class=\"iLikeThis\" id=\"iLikeThis-182261\"><span class=\"counter\"><a class=\"image\" onclick=\"likeThis(182261);\">9<\/a><\/span><\/div><\/div>\n<p class=\"postmetadata\">\n<small>\n\t\t\t\t\t\tThis entry was posted\n\t\t\t\t\t\t\t\t\t\t\t\ton Wednesday, September 12th, 2012 at 9:00 am\t\t\t\t\t\tand is filed under <a href=\"http:\/\/www.ludumdare.com\/compo\/category\/ld-24\/\" rel=\"category tag\" title=\"View all posts in LD #24\">LD #24<\/a>.\n\t\t\t\t\t\tYou can follow any responses to this entry through the <a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/09\/12\/ld-24-creating-procedural-critters\/feed\/\">RSS 2.0<\/a> feed.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tYou can <a href=\"#respond\">leave a response<\/a>, or <a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/09\/12\/ld-24-creating-procedural-critters\/trackback\/\" rel=\"trackback\">trackback<\/a> from your own site.\n\n\t\t\t\t\t\t\n\t\t\t\t\t<\/small>\n<\/p>","time":"September 12th, 2012 9:00 am","title":"LD 24: Creating procedural critters","title_was_empty":false}