{"id":2626,"date":"2016-04-08T22:21:16","date_gmt":"2016-04-08T21:21:16","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=2626"},"modified":"2016-04-08T22:21:16","modified_gmt":"2016-04-08T21:21:16","slug":"p-152-virtual-world-concept-update-104-fractal-terrain-texturing-part-1","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-152-virtual-world-concept-update-104-fractal-terrain-texturing-part-1\/","title":{"rendered":"P-152: Virtual World Concept Update 104: Fractal Terrain Texturing Part 1"},"content":{"rendered":"<p>I have added texturing to the spherical terrain. This ended up taking a lot less time than I thought, although I did run into some issues.<\/p>\n<p>For some time, the textured tris were rendering as a random group, instead of a terrain.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2619\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-07_04_2016-09_33_15-PM-300x195.png\" alt=\"PhoenixGameDevelopment - 07_04_2016 , 09_33_15 PM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-07_04_2016-09_33_15-PM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-07_04_2016-09_33_15-PM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-07_04_2016-09_33_15-PM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-07_04_2016-09_33_15-PM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>I couldn&#8217;t figure out what was causing this, until I realised that the tris looked exactly like the default player model in T3D:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2627\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_25_43-AM-1-300x195.png\" alt=\"PhoenixGameDevelopment - 08_04_2016 , 01_25_43 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_25_43-AM-1-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_25_43-AM-1-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_25_43-AM-1-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_25_43-AM-1.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>I eventually figured out, with the aid of the GarageGames IRC chat, that the Render Manage system in torque does not take primitive and vertex buffers as values, it takes them as references. What I was doing was creating a vertex buffer locally, and loading it with the correct verts, then calling the function to add that render instance to the render pass manager.<\/p>\n<p>However, since this function takes reference, and not values, once the render function finished executing, the local vertex buffer that I had created was destroyed. This meant that the render pass manager had no vertex buffer to read from, and ended up reading from a random area of memory, which in this case, happened to be occupied by the default player model&#8217;s vertex buffer.<\/p>\n<p>Once I fixed this, the textures appeared:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2625\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_44_21-AM-300x195.png\" alt=\"PhoenixGameDevelopment - 08_04_2016 , 01_44_21 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_44_21-AM-300x195.png 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_44_21-AM-768x498.png 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_44_21-AM-1024x664.png 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_44_21-AM.png 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2630\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_45_06-AM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 08_04_2016 , 01_45_06 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_45_06-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_45_06-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_45_06-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-01_45_06-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2629\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-08_12_24-PM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 08_04_2016 , 08_12_24 PM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-08_12_24-PM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-08_12_24-PM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-08_12_24-PM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-08_04_2016-08_12_24-PM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>They look very good, I am quite happy with how this project is progressing. The only issues are that the textures on the lowest detailed tier of the terrain are distorted (This is likely a UV\/Texcoord issue) and the framerate drops quite quickly as the terrain is subdivided.<\/p>\n<p>The seaming issue is also quite obvious, but this will be fixed.<\/p>\n<p>The next goals are to fix the texturing issues, and add the ability for multiple textures to be rendered based on height. I will also need to fix the seams, and scale the terrain to realistic planet sizes. There is a lot of work left to be done, but the project is progressing extremely well.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have added texturing to the spherical terrain. This ended up taking a lot less time than I thought, although I did run into some issues. For some time, the textured tris were rendering as a random group, instead of a terrain. I couldn&#8217;t figure out what was causing this, until I realised that the [&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-2626","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\/2626"}],"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=2626"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2626\/revisions"}],"predecessor-version":[{"id":2632,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2626\/revisions\/2632"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=2626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=2626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=2626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}