{"id":276,"date":"2019-03-14T20:37:30","date_gmt":"2019-03-14T20:37:30","guid":{"rendered":"http:\/\/blogs.oregonstate.edu\/copcas\/?p=276"},"modified":"2019-03-14T20:42:47","modified_gmt":"2019-03-14T20:42:47","slug":"procedural-terrain-diamond-square-algorithm-java","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/copcas\/2019\/03\/14\/procedural-terrain-diamond-square-algorithm-java\/","title":{"rendered":"Procedural Terrain &#8211; Diamond Square Algorithm (Java)"},"content":{"rendered":"<p>Hello everyone,<\/p>\n<p>I created an implementation of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Diamond-square_algorithm\">Diamond Square Algorithm<\/a> which is a method for developing procedurally generated terrain that can be used for video games or computer graphics. In this implementation of the algorithm I used java to generate a procedural square terrain with a variable amount of subdivisions. I then exported the vertex information of the terrain as a .obj file which can be used in almost any 3D editor.<\/p>\n<p>Here is a link to the <a href=\"https:\/\/drive.google.com\/file\/d\/1RUjrTjhP_wldfZBZZ4L4cj4dZkNA3nU_\/view?usp=sharing\">main code<\/a> for the implementation.<\/p>\n<p>If that does not work here are images of the main functions:<\/p>\n<p><a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part1.png\">Part 1<\/a>\u00a0\u00a0<a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part2.png\">Part 2\u00a0<\/a>\u00a0\u00a0<a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part3.png\">Part 3<\/a>\u00a0\u00a0<a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part4.png\">Part 4<\/a>\u00a0\u00a0<a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part5.png\">Part 5<\/a>\u00a0\u00a0<a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part6.png\">Part 6<\/a>\u00a0\u00a0<a href=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/Part7.png\">Part 7<\/a><\/p>\n<p>Here are some example procedural terrains I generated from the code.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-284 aligncenter\" src=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/test7-300x169.jpg\" alt=\"\" width=\"399\" height=\"225\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test7-300x169.jpg 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test7-768x432.jpg 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test7.jpg 960w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\" wp-image-285 aligncenter\" src=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/test5-300x169.jpg\" alt=\"\" width=\"399\" height=\"225\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test5-300x169.jpg 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test5-768x432.jpg 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test5.jpg 960w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\" wp-image-286 aligncenter\" src=\"http:\/\/blogs.oregonstate.edu\/copcas\/files\/2019\/03\/test6-300x169.jpg\" alt=\"\" width=\"399\" height=\"225\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test6-300x169.jpg 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test6-768x432.jpg 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/3254\/files\/2019\/03\/test6.jpg 960w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/p>\n<p>&#8211; Ben Johnson<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone, I created an implementation of the Diamond Square Algorithm which is a method for developing procedurally generated terrain that can be used for video games or computer graphics. In this implementation of the algorithm I used java to generate a procedural square terrain with a variable amount of subdivisions. I then exported the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blogs.oregonstate.edu\/copcas\/2019\/03\/14\/procedural-terrain-diamond-square-algorithm-java\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Procedural Terrain &#8211; Diamond Square Algorithm (Java)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":9596,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/users\/9596"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/comments?post=276"}],"version-history":[{"count":7,"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":293,"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/posts\/276\/revisions\/293"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/media?parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/categories?post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/copcas\/wp-json\/wp\/v2\/tags?post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}