{"id":54,"date":"2010-10-25T01:29:53","date_gmt":"2010-10-25T00:29:53","guid":{"rendered":"http:\/\/www.joesfer.com\/?p=54"},"modified":"2010-10-26T10:03:41","modified_gmt":"2010-10-26T09:03:41","slug":"nature-patterns","status":"publish","type":"post","link":"http:\/\/www.joesfer.com\/?p=54","title":{"rendered":"Nature patterns"},"content":{"rendered":"<p>In the field of Texture Synthesis, I recently discovered the wonders of the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Reaction%E2%80%93diffusion_system\" target=\"_blank\">Reaction Diffusion System<\/a> for nature-like patterns synthesis. The RD method consists on a set of equations which iteratively simulate the distribution of a chemical agent (<em>activator<\/em>) modulated by the presence of another agent called <em>inhibitor<\/em>. It is believed that such interactions take place in nature to form patterns which can be found in mammals and fish, and the first model, generating spots, was proposed by Turing himself <strong>[Turing 52]<\/strong>, dating back from 1952!.<\/p>\n<h2>Reaction Diffusion<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignright\" title=\"animals\" src=\"http:\/\/www.joesfer.com\/wp-content\/uploads\/programming\/processing\/RD\/media\/animals.jpg\" alt=\"\" width=\"334\" height=\"442\" \/>By playing with the parameters of an RD system, it is possible to simulate a variety of patterns ranging from spots to stripes. Unfortunately I haven&#8217;t found huge amounts of information on the subject (let alone up-to-date resources): one of the most complete texts is Greg Turk&#8217;s thesis <strong>[Turk 91]<\/strong>, which covers both Turing-like spots and stripes. For the later, the most extended set of equations is the one proposed by <strong>[Meinhardt 82]<\/strong> which generates the kind of images I wanted to achieve.<\/p>\n<p>The main problem <em>in practice<\/em>, however, is that Meinhardt&#8217;s description consists on 5 equations with several <strong>magic constants<\/strong> (which might make sense in chemical terms, but the authors seem to obviate) that lead to a large search space. Even more fun, the system is <em>really<\/em> sensitive to small variations on the value of each constant, and I spent quite a lot of time searching for a set of values which was <em>stable <\/em>and <em>converged <\/em>to something meaningful. Luckily, <strong>[Asai 99]<\/strong> and <strong>[Kondo 09]<\/strong> provide an alternative formulation of Meinhardt&#8217;s RD system, and an <em><strong>illustrated<\/strong><\/em> set of values to play with, which is how I ended up implementing it.<\/p>\n<div id=\"attachment_48\" style=\"width: 390px\" class=\"wp-caption aligncenter\"><\/p>\n<p><img aria-describedby=\"caption-attachment-48\" decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.joesfer.com\/wp-content\/ql-cache\/quicklatex.com-d38327790de3c68286b9362211681510_l3.png\" class=\"ql-img-inline-formula \" alt=\" &#92;&#102;&#114;&#97;&#99;&#123;&#92;&#112;&#97;&#114;&#116;&#105;&#97;&#108;&#32;&#117;&#125;&#123;&#92;&#112;&#97;&#114;&#116;&#105;&#97;&#108;&#32;&#116;&#125;&#32;&#61;&#32;&#120;&#40;&#117;&#44;&#118;&#41;&#32;&#45;&#32;&#100;&#123;&#92;&#99;&#100;&#111;&#116;&#125;&#117;&#32;&#43;&#32;&#68;&#95;&#123;&#117;&#125;&#92;&#98;&#105;&#103;&#116;&#114;&#105;&#97;&#110;&#103;&#108;&#101;&#100;&#111;&#119;&#110;&#94;&#50;&#117;&#92;&#110;&#101;&#119;&#108;&#105;&#110;&#101; &#92;&#102;&#114;&#97;&#99;&#123;&#92;&#112;&#97;&#114;&#116;&#105;&#97;&#108;&#32;&#118;&#125;&#123;&#92;&#112;&#97;&#114;&#116;&#105;&#97;&#108;&#32;&#116;&#125;&#32;&#61;&#32;&#121;&#40;&#117;&#44;&#118;&#41;&#32;&#45;&#32;&#103;&#123;&#92;&#99;&#100;&#111;&#116;&#125;&#118;&#32;&#43;&#32;&#68;&#95;&#123;&#118;&#125;&#92;&#98;&#105;&#103;&#116;&#114;&#105;&#97;&#110;&#103;&#108;&#101;&#100;&#111;&#119;&#110;&#94;&#50;&#118;&#92;&#110;&#101;&#119;&#108;&#105;&#110;&#101; &#120;&#40;&Acirc;&#8230;&#117;&#44;&#118;&#41;&#32;&#61;&Acirc;&#8224;&#32;&Acirc;&circ;&#32;&#97;&#123;&#92;&#99;&#100;&#111;&#116;&#125;&#117;&#32;&#45;&#32;&#98;&#123;&#92;&#99;&#100;&#111;&#116;&#125;&#118;&#32;&#43;&#32;&#99;&#92;&#110;&#101;&#119;&#108;&#105;&#110;&#101; &#121;&#40;&Acirc;&#8230;&#117;&#44;&#118;&#41;&#32;&#61;&Acirc;&#8224;&#32;&Acirc;&circ;&#32;&#101;&#123;&#92;&#99;&#100;&#111;&#116;&#125;&#117;&#32;&#45;&#32;&#102;&#92;&#110;&#101;&#119;&#108;&#105;&#110;&#101; \" title=\"Rendered by QuickLaTeX.com\" height=\"70\" width=\"447\" style=\"vertical-align: -5px;\"\/><\/p>\n<p><p id=\"caption-attachment-48\" class=\"wp-caption-text\">RD Strip system as appears in |Asai 99|. The reference value for the constants is a \u00c2\u02c6= 0.08, b =\u00c2\u02c6 0.08, c \u00c2\u02c6= 0.28, d =\u00c2\u02c6 0.03, e =\u00c2\u02c6 0.1, f =\u00c2\u02c6 0.15, g =\u00c2\u02c6 0.05<\/p><\/div>\n<p>Below is an applet created with Processing which illustrates the process, it starts with a randomized concentration of the activator an inhibitor agents, and a small set of frozen points in the grid which help creating &#8220;vortices&#8221;. If you let it run long enough, it should converge to a nice seamless pattern with spirals (not that I&#8217;ve seen a fish with that pattern, but it would be cool!).<br \/>\n<code><\/p>\n<div id=\"processing\"><!--[if !IE]> --><br \/>\n<object classid=\"java:DiffusionReaction.class\" type=\"application\/x-java-applet\" archive=\"wp-content\/uploads\/programming\/processing\/RD\/DiffusionReaction.jar\" standby=\"Loading Processing software...\" height=\"500\" width=\"500\"><param name=\"archive\" value=\"wp-content\/uploads\/programming\/processing\/RD\/DiffusionReaction.jar\"><param name=\"mayscript\" value=\"true\"><param name=\"scriptable\" value=\"true\"><param name=\"image\" value=\"wp-content\/uploads\/programming\/processing\/loading.gif\"><param name=\"boxmessage\" value=\"Loading Processing software...\"><param name=\"boxbgcolor\" value=\"#FFFFFF\"><param name=\"test_string\" value=\"outer\"><![endif]--><br \/>\n<object classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\" codebase=\"http:\/\/java.sun.com\/update\/1.4.2\/jinstall-1_4_2_12-windows-i586.cab\" standby=\"Loading Processing software...\" height=\"512\" width=\"512\"><param name=\"code\" value=\"DiffusionReaction\"><param name=\"archive\" value=\"wp-content\/uploads\/programming\/processing\/RD\/DiffusionReaction.jar\"><param name=\"mayscript\" value=\"true\"><param name=\"scriptable\" value=\"true\"><param name=\"image\" value=\"wp-content\/uploads\/programming\/processing\/loading.gif\"><param name=\"boxmessage\" value=\"Loading Processing software...\"><param name=\"boxbgcolor\" value=\"#FFFFFF\"><param name=\"test_string\" value=\"inner\"><p>This browser does not have a Java Plug-in.<br \/><a href=\"http:\/\/java.sun.com\/products\/plugin\/downloads\/index.html\" title=\"Download Java Plug-in\">Get the latest Java Plug-in here.<\/a><\/p><\/object><br \/>\n<!--[if !IE]> --><\/object><br \/>\n<!--<![endif]-->\n<\/div>\n<p>'Space' key to reset simulation. 'Enter' key to stop. Built with <a title=\"Processing.org\" href=\"http:\/\/processing.org\">Processing<\/a><br \/>\n<\/code><\/p>\n<p>And it produces some great displacement maps!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"http:\/\/www.joesfer.com\/wp-content\/uploads\/programming\/processing\/RD\/media\/displacement.jpeg\" title=\"Displacement\" class=\"aligncenter\" width=\"512\" height=\"512\" \/><\/p>\n<h2>References<\/h2>\n<p>[Turing 52] Turing, Alan, \u00e2\u20ac\u0153The Chemical Basis of Morphogenesis,\u00e2\u20ac\u009d Philosophical Transactions of the Royal Society B, Vol. 237, pp. 37\u00e2\u20ac\u201c72 (August 14, 1952).<\/p>\n<p>[Meinhardt 82] Meinhardt, Hans, Models of Biological Pattern Formation, Academic Press, London, 1982.<\/p>\n<p>[<a href=\"http:\/\/www.cc.gatech.edu\/~turk\/reaction_diffusion\/reaction_diffusion.html\" target=\"_blank\">Turk 91<\/a>] Turk, Greg, &#8220;Texturing Surfaces Using Reaction-Diffusion&#8221; Ph.D. Thesis, 1981<\/p>\n<p>[<a href=\"http:\/\/www.google.es\/url?sa=t&amp;source=web&amp;cd=3&amp;ved=0CCIQFjAC&amp;url=http%3A%2F%2Fconlonlab.org%2Fcourses%2Fmaterials%2F523mats%2FTuring%2FAsai.pdf&amp;rct=j&amp;q=.%20Zebrafish%20leopard%20gene%20as%20a%20component%20of%20the%20putative%20reaction%E2%80%93diffusion%20system&amp;ei=VRPCTKOvHYKV4gb7yM3QCw&amp;usg=AFQjCNGxLk5GqKxP3B50bcJ2C5o_gvGSxA&amp;cad=rja\" target=\"_blank\">Asai 99<\/a>] Rihito Asaia, Emiko Taguchia, Yukari Kumea, Mayumi Saitoa, Shigeru Kondoa, &#8220;Zebrafish Leopard gene as a component of the putative reaction-diffusion system&#8221;.<\/p>\n<p>[<a href=\"http:\/\/www.fbs.osaka-u.ac.jp\/labs\/skondo\/paper\/shirota%20%20seminors%20in%20dev%20biol.pdf\" target=\"_blank\">Kondo 09<\/a>] Shigeru Kondo, Hideaki Shirota, &#8220;Theoretical analysis of mechanisms that generate the pigmentation pattern of animals&#8221;, Division of Biological Science, Graduate School of Science, Nagoya University, Furo-cho, Chikusa-ku, Nagoya 464-8602, Japan<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Reaction Diffusion system to generate natural-looking seamless patterns found in some mammals and fish. <a class=\"more-link\" href=\"http:\/\/www.joesfer.com\/?p=54\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[24,26,25,21,8,23,18],"_links":{"self":[{"href":"http:\/\/www.joesfer.com\/index.php?rest_route=\/wp\/v2\/posts\/54"}],"collection":[{"href":"http:\/\/www.joesfer.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.joesfer.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.joesfer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.joesfer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54"}],"version-history":[{"count":0,"href":"http:\/\/www.joesfer.com\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.joesfer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.joesfer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.joesfer.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}