{"id":2579,"date":"2016-04-03T23:58:38","date_gmt":"2016-04-03T22:58:38","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=2579"},"modified":"2016-04-04T02:53:20","modified_gmt":"2016-04-04T01:53:20","slug":"p-152-virtual-world-concept-update-101-fractal-terrain-generation-part-7","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-152-virtual-world-concept-update-101-fractal-terrain-generation-part-7\/","title":{"rendered":"P-152: Virtual World Concept Update 101: Fractal Terrain Generation Part 7"},"content":{"rendered":"<p>I have implemented a good deal of the fractal midpoint displacement algorithm. The main problem that I had was in determining how to handle the array that the algorithm uses. Generally, and array would be created that is the size of the entire terrain, ie, 4096&#215;4096. I can&#8217;t do that in this case, since I am using a quadtree. I am not sure how to properly implement this algorithm, but my first attempt simple performs the algorithm on each node at a time. It doesn&#8217;t create an array, just creates 4 child nodes from one parent node each time.<\/p>\n<p>However, the terrain will subdivide further and further as the user gets closer, which means that the recursive step of the fractal midpoint algorithm will be performed, just in an uncommon way. I do not know if this will work or not.<\/p>\n<p>I am going to use conventional random noise (not perlin noise) with this algorithm for now. Implementing reproducible noise will be difficult, since I will need to send the same seed values to the algorithm each time, even after all of the subdivision steps.\u00a0. I am not certain how to achieve this.<\/p>\n<p>I am confident that I am making at least some progress though, the outcome of the fractal midpoint displacement algorithm should\u00a0prove this one way or another.<\/p>\n<p>These images show the initial attempts as the algorithm, I had some issues with the winding order of the quads (It is clockwise, in T3D).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2581\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_21_02-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_21_02 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_21_02-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_21_02-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_21_02-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_21_02-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2582\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_17_42-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_17_42 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_17_42-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_17_42-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_17_42-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_17_42-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2586\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_13_20-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_13_20 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_13_20-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_13_20-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_13_20-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_13_20-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\nThese are the 9 points that I am using for the midpoint algorithm. 4 corner points, a centerpoint, and 4 midpoints.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2587\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-03_04_2016-11_44_38-PM-300x192.png\" alt=\"PhoenixGameDevelopment - 03_04_2016 , 11_44_38 PM\" width=\"300\" height=\"192\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-03_04_2016-11_44_38-PM-300x192.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-03_04_2016-11_44_38-PM-768x490.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-03_04_2016-11_44_38-PM-1024x654.png 1024w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\nThis is the current state of the terrain. I haven&#8217;t done anything about the colour values yet, so they don&#8217;t change from parent to child. It can be clearly seen here that each parent node splits into four child nodes, which occupy the same space. I now need to apply a noise value to only the center point of the child nodes. The reason why I only add noise to the center point is to make sure that the edges of the quads will still line up. This is where I will have trouble later, since the fractal midpoint algorithm is meant to run on an entire array, not a single quad, so the noise generation won&#8217;t work properly. I will need to research this further.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2591\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_43_14-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_43_14 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_43_14-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_43_14-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_43_14-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_43_14-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2589\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_55-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_42_55 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_55-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_55-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_55-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_55-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2590\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_49-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_42_49 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_49-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_49-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_49-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_42_49-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>I am also having a problem with view distances. Currently, I am using a single view distance for all LOD&#8217;s. This means that the lower tier nodes are always in range if their parent nodes are, which means the algorithm is not optimised. I will need to scale the view distance down for each tier.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2593\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_55_19-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 04_04_2016 , 12_55_19 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_55_19-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_55_19-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_55_19-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-04_04_2016-12_55_19-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>I could be close to getting a concept done for the terrain, if I can solve the remaining problems, especially the noise issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have implemented a good deal of the fractal midpoint displacement algorithm. The main problem that I had was in determining how to handle the array that the algorithm uses. Generally, and array would be created that is the size of the entire terrain, ie, 4096&#215;4096. I can&#8217;t do that in this case, since I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,17,10,11],"tags":[],"class_list":["post-2579","post","type-post","status-publish","format-standard","hentry","category-astral-realms","category-p-0","category-software-and-games","category-spiritus-astrum","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"aioseo_notices":[],"builder_content":"","_links":{"self":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2579"}],"collection":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/comments?post=2579"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2579\/revisions"}],"predecessor-version":[{"id":2595,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2579\/revisions\/2595"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=2579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=2579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=2579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}