{"id":22,"date":"2007-07-11T16:39:23","date_gmt":"2007-07-11T22:39:23","guid":{"rendered":"http:\/\/blog.blockos.org\/?p=65"},"modified":"2007-07-11T16:39:23","modified_gmt":"2007-07-11T22:39:23","slug":"the-attack-of-the-patatoids","status":"publish","type":"post","link":"https:\/\/blog.blockos.org\/?p=22","title":{"rendered":"The Attack of the Patatoids!"},"content":{"rendered":"<p>Last day i was reading the wikipedia article about the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pioneer_program\">Pioneer program<\/a>. I don\u2019t know how, but after following some links i ended on the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Hayabusa\">Hayabusa<\/a> mission article.<br \/>\nThe Hayabusa space probe was launch in 2003 to study the <a href=\"http:\/\/en.wikipedia.org\/wiki\/25143_Itokawa\">Itokawa<\/a> asteroid. The most ambitious part of the mission was about landing on the astoreid to collect samples. From what i understood, the samples would not have been collected by drilling the asteroid but from the debris made by the collision between the asteroid and a projectile launched from the space probe. Unfortunately, the attempts to land on the asteroid failed. Nevertheless, it seems that the Hayabusa managed to collect some samples.<br \/>\nThe Hayabusa may be bak to earth around 2010.<\/p>\n<p>Using the data collected, Robert Gaskell from the <a href=\"http:\/\/www.psi.edu\/\">Planetary Science Institute<\/a> generated <a href=\"http:\/\/hayabusa.sci.isas.jaxa.jp\/shape.pl\">3D models of the Itokawa asteroid<\/a>. The model is available in 3 formats (plate-vertex table, STL ASCII and triangle) and in 4 resolutions (from 49,152 to 3,145,728 triangles).<br \/>\nThe plate-vertex table format is similar to ply2 format. So, i took the 3M triangles version. Translated it into ply2 and launched my crappy raytracer on it.<br \/>\nI was surprised by the rendering speed. A 256\u00d7256 image was rendered in less than 1 minute. Nevertheless, i had a nasty bug \ud83d\ude41<\/p>\n<p><a href='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_buggy.png' title='Buggy rendering of Itokawa asteroid'><img src='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_buggy.thumbnail.png' alt='Buggy rendering of Itokawa asteroid' \/><\/a><\/p>\n<p>As you may have noticed there\u2019s a bug on the left part. Here\u2019s a close up.<\/p>\n<table>\n<tr>\n<td align=\"center\"> buggy <\/td>\n<td align=\"center\"> correct <\/td>\n<\/tr>\n<tr>\n<td><a href='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_buggy_closeup.png' title='Buggy rendering of Itokawa asteroid (close up)'><img src='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_buggy_closeup.thumbnail.png' alt='Buggy rendering of Itokawa asteroid (close up)' \/><\/a><\/td>\n<td><a href='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_correct_closeup.png' title='Correct rendering of Itokawa asteroid (correct)'><img src='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_correct_closeup.thumbnail.png' alt='Correct rendering of Itokawa asteroid (correct)' \/><\/a><\/td>\n<\/tr>\n<\/table>\n<p>The \u201ccorrect\u201d image was obtained after 3 hours of computation by disabling BVH. So the problem came from the BVH code. After almost rewriting the BVH building and intersection code, i still had the same bug. Some heavy code review later, i realized that the wrong ray intersection was returned. In fact it was the informations of the last intersection instead of the one from the closest intersection point. It\u2019s a very stupid bug. Well at least i cleaned up the BVH code.<br \/>\nSo for your pleasure here is a nice 512\u00d7512 image of the Itokawa asteroid.<\/p>\n<p><a href='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_512.png' title='512\u00d7512 image of Itokawa asteroid'><img src='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_512.thumbnail.png' alt='512\u00d7512 image of Itokawa asteroid' \/><\/a><\/p>\n<p>And some stats:<\/p>\n<ul>\n<li>BVH building time : 0h 0min 38.943722 sec<\/li>\n<li>Rendering time : 0h 0min 7.411200 sec<\/li>\n<\/ul>\n<p>As i said before, the code is greatly unoptimized but it manages to render a 3M triangles model in less than one minute. I\u2019ll try to speed up the BVH building code, use a clever cost function and monitor memory usage (while running the top command, i noticed that more than 70% of the RAM (1go) was used.)<\/p>\n<p><strong>Bonus<\/strong> : dark side of the patatoid!<\/p>\n<p><a href='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_dksd.png' title='Dark side of the Itokawa asteroid'><img src='http:\/\/blog.blockos.org\/wp-content\/uploads\/2007\/07\/itokawa_dksd.thumbnail.png' alt='Dark side of the Itokawa asteroid' \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last day i was reading the wikipedia article about the Pioneer program. I don\u2019t know how, but after following some links i ended on the Hayabusa mission article. The Hayabusa space probe was launch in 2003 to study the Itokawa asteroid. The most ambitious part of the mission was about\u2026 <a class=\"continue-reading-link\" href=\"https:\/\/blog.blockos.org\/?p=22\">Continue reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,4],"tags":[27,28,15],"_links":{"self":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/22"}],"collection":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22"}],"version-history":[{"count":0,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.blockos.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}