{"id":3154,"date":"2016-06-25T01:02:36","date_gmt":"2016-06-25T00:02:36","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=3154"},"modified":"2016-06-25T01:02:36","modified_gmt":"2016-06-25T00:02:36","slug":"p-152-virtual-world-concept-update-127-planet-sized-terrain-part-6","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-152-virtual-world-concept-update-127-planet-sized-terrain-part-6\/","title":{"rendered":"P-152: Virtual World Concept Update 127: Planet-sized Terrain: Part 6"},"content":{"rendered":"<p>I have discovered, and fixed, a bug in the procedural texturing code for the spherical terrain.<\/p>\n<p>Initially, I had set the terrain&#8217;s position to the origin. However, to render the planet at a realistic scale, I need to implement the floating origin system, which requires being able to specify an arbitrary position for the planet. I had implemented this, but I hadn&#8217;t realised that there was a bug in the code which meant that the distance calculations for the minimum and maximum terrain heights weren&#8217;t properly taking into account the changes in the planets position.<\/p>\n<p>This meant that the planet was not being textured properly.<\/p>\n<p>This turned out to be more complex to fix than I thought, I first ended up with this effect:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3146\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-03_42_53-AM-300x194.jpg\" alt=\"P152_DEBUG 21\/06\/2016 , 03:42:53 AM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-03_42_53-AM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-03_42_53-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-03_42_53-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-03_42_53-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>And I then finally managed to get a working solution:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3145\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-11_03_13-PM-300x194.jpg\" alt=\"P152_DEBUG 21\/06\/2016 , 11:03:13 PM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-11_03_13-PM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-11_03_13-PM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-11_03_13-PM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-21_06_2016-11_03_13-PM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3144\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_02_11-AM-300x194.jpg\" alt=\"P152_DEBUG 22\/06\/2016 , 01:02:11 AM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_02_11-AM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_02_11-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_02_11-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_02_11-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3143\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_04_56-AM-300x194.jpg\" alt=\"P152_DEBUG 22\/06\/2016 , 01:04:56 AM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_04_56-AM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_04_56-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_04_56-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-01_04_56-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>But that was still not correct, the min and max height values were strongly biased in favour or water and rock types. Eventually I solved the issues, and the terrain renders correctly. As it turned out, it was easier than I thought to solve this, I didn&#8217;t actually need to take into account the world position at all, since the terrain coordinates were in local space.<\/p>\n<p><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-03_23_34-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3142\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-03_23_34-AM-300x194.jpg\" alt=\"P152_DEBUG 22\/06\/2016 , 03:23:34 AM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-03_23_34-AM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-03_23_34-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-03_23_34-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-03_23_34-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_35_42-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3141\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_35_42-AM-300x194.jpg\" alt=\"P152_DEBUG 22\/06\/2016 , 04:35:42 AM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_35_42-AM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_35_42-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_35_42-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_35_42-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-3140\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_37_47-AM-300x194.jpg\" alt=\"P152_DEBUG 22\/06\/2016 , 04:37:47 AM Torque 3D MIT - P152\" width=\"300\" height=\"194\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_37_47-AM-300x194.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_37_47-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_37_47-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/06\/PhoenixGameDevelopment-22_06_2016-04_37_47-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>This solution has also solved a lot of the texturing issues that I was having with the terrain scaling, in fact, the texture looks more or less correct now. This has inspired me to continue trying to solve the realistic terrain problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have discovered, and fixed, a bug in the procedural texturing code for the spherical terrain. Initially, I had set the terrain&#8217;s position to the origin. However, to render the planet at a realistic scale, I need to implement the floating origin system, which requires being able to specify an arbitrary position for the planet. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,17,10,11],"tags":[],"class_list":["post-3154","post","type-post","status-publish","format-standard","hentry","category-art-and-designs","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\/3154"}],"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=3154"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/3154\/revisions"}],"predecessor-version":[{"id":3161,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/3154\/revisions\/3161"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=3154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=3154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=3154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}