{"id":2647,"date":"2016-04-10T23:21:10","date_gmt":"2016-04-10T22:21:10","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=2647"},"modified":"2016-04-10T23:21:10","modified_gmt":"2016-04-10T22:21:10","slug":"p-152-virtual-world-concept-update-106-terrain-collision-and-texturing","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-152-virtual-world-concept-update-106-terrain-collision-and-texturing\/","title":{"rendered":"P-152: Virtual World Concept Update 106: Terrain Collision and Texturing"},"content":{"rendered":"<p>I have fixed the collision issues that I was having with the spherical terrain. It turned out that I was adding the wrong nodes to the collision mesh. I now have reliable collision working. I am only adding a collision mesh to the most detailed LOD, since that is where the player will be standing. I don&#8217;t need collision at further distances.<\/p>\n<p>I have also thought a bit about the texturing. My initial idea was to add several materials to the terrain, and use a different vertex and primitive buffer for each. However, this would only allow me to texture the nodes, not the vertices. This means that there would be a noticeable square, blocky boundary between the different material zones. I would not be able to effectively blend between them.<\/p>\n<p>The best thing to do here would be to use a shader. I can apply a single material to the terrain, and map a shader to that material. I can then access the pixel values using the shader and, based on their height, apply a different material to each one.<\/p>\n<p>Shaders are incredibly powerful, (In fact, it is possible to generate terrain using just a shader) and I should also be able to perform all kinds of optimisations, such as blending, lighting, shading, etc etc.<\/p>\n<p>I don&#8217;t know a whole lot about shaders, so I will need to research this a bit more before I attempt to implement it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2655\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_09_32-AM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 10_04_2016 , 02_09_32 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_09_32-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_09_32-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_09_32-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_09_32-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2654\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-09_04_2016-11_48_48-PM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 09_04_2016 , 11_48_48 PM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-09_04_2016-11_48_48-PM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-09_04_2016-11_48_48-PM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-09_04_2016-11_48_48-PM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-09_04_2016-11_48_48-PM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2653\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-01_45_21-AM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 10_04_2016 , 01_45_21 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-01_45_21-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-01_45_21-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-01_45_21-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-01_45_21-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2652\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_07_38-AM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 10_04_2016 , 02_07_38 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_07_38-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_07_38-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_07_38-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_07_38-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2651\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_43-AM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 10_04_2016 , 02_08_43 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_43-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_43-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_43-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_43-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2650\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_55-AM-300x195.jpg\" alt=\"PhoenixGameDevelopment - 10_04_2016 , 02_08_55 AM\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_55-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_55-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_55-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-10_04_2016-02_08_55-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have fixed the collision issues that I was having with the spherical terrain. It turned out that I was adding the wrong nodes to the collision mesh. I now have reliable collision working. I am only adding a collision mesh to the most detailed LOD, since that is where the player will be standing. [&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-2647","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\/2647"}],"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=2647"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2647\/revisions"}],"predecessor-version":[{"id":2657,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2647\/revisions\/2657"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=2647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=2647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=2647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}