{"id":4353,"date":"2016-12-04T23:44:13","date_gmt":"2016-12-04T23:44:13","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=4353"},"modified":"2016-12-05T00:16:32","modified_gmt":"2016-12-05T00:16:32","slug":"p0-p-172-part-58-see-multiple-terrain-textures-with-blending","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p0-p-172-part-58-see-multiple-terrain-textures-with-blending\/","title":{"rendered":"P0-P-172: Part 58: SEE: Multiple Terrain Textures with blending"},"content":{"rendered":"<p>I have had to abandon the idea of using the existing colour-based rendering\/texturing system. I can&#8217;t find a way to send the data that I need per pixel, only per terrain chunk, which wouldn&#8217;t work (I could render each chunk with a different texture, but not each individual pixel, which would look terrible).<\/p>\n<p>I will therefore need to use the strategy that I used before with my previous terrain (P-152). Thankfully, I can send the min and max values of the terrain easily using the SEE, and the world position can be obtained from the shader in unity. I also need to send the center position of the terrain.<\/p>\n<p>I am concerned with using these values however, since the world position and center position of the planet are very large floating point numbers, and I may have precision issues when working with them. For now, I have actually decided to use doubles, not floats, in the shader (doubles being 64-bit, rather than 32-bit) but doubles are only supported, I believe, in shader model 5 (Some of the 4.* updates may also support doubles, I am not sure).<\/p>\n<p>Shader model 5 is the newest shader model, and as such, would not be supported by the majority of hardware yet. This causes a significant compatibility problem. I will need to create some kind of &#8220;fallback&#8221; option in the future, but for now, this option works, and I can evenly subdivide the terrain based on height.<\/p>\n<p>I am also concerned with how this solution with work for very distance planets, or multiple planets, I haven&#8217;t had a chance to test this yet. I am confident that I will be able to solve these issues if and when I run into them though.<\/p>\n<p>I now need to blend each layer, which should be fairly simple, since I can refer back to the shaders I wrote in P-152.<\/p>\n<figure id=\"attachment_4329\" aria-describedby=\"caption-attachment-4329\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_21_28-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4329\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_21_28-PM-300x163.jpg\" alt=\"Unity 29\/11\/2016 , 08:21:28 PM Unity Personal (64bit) - P0Main.unity - New Unity Project - PC, Mac &amp; Linux Standalone* \" width=\"300\" height=\"163\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_21_28-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_21_28-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_21_28-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_21_28-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4329\" class=\"wp-caption-text\">Unity<br \/>29\/11\/2016 , 08:21:28 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone*<\/figcaption><\/figure>\n<figure id=\"attachment_4331\" aria-describedby=\"caption-attachment-4331\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_22_16-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4331\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_22_16-PM-300x163.jpg\" alt=\"Unity 29\/11\/2016 , 08:22:16 PM Unity Personal (64bit) - P0Main.unity - New Unity Project - PC, Mac &amp; Linux Standalone* \" width=\"300\" height=\"163\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_22_16-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_22_16-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_22_16-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_22_16-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4331\" class=\"wp-caption-text\">Unity<br \/>29\/11\/2016 , 08:22:16 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone*<\/figcaption><\/figure>\n<figure id=\"attachment_4332\" aria-describedby=\"caption-attachment-4332\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_25_51-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4332\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_25_51-PM-300x163.jpg\" alt=\"Unity 29\/11\/2016 , 08:25:51 PM Unity Personal (64bit) - P0Main.unity - New Unity Project - PC, Mac &amp; Linux Standalone* \" width=\"300\" height=\"163\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_25_51-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_25_51-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_25_51-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-29_11_2016-08_25_51-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4332\" class=\"wp-caption-text\">Unity<br \/>29\/11\/2016 , 08:25:51 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone*<\/figcaption><\/figure>\n<figure id=\"attachment_4334\" aria-describedby=\"caption-attachment-4334\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-30_11_2016-01_06_36-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4334\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-30_11_2016-01_06_36-AM-300x163.jpg\" alt=\"Unity 30\/11\/2016 , 01:06:36 AM Unity Personal (64bit) - P0Main.unity - New Unity Project - PC, Mac &amp; Linux Standalone \" width=\"300\" height=\"163\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-30_11_2016-01_06_36-AM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-30_11_2016-01_06_36-AM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-30_11_2016-01_06_36-AM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-30_11_2016-01_06_36-AM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4334\" class=\"wp-caption-text\">Unity<br \/>30\/11\/2016 , 01:06:36 AM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n<figure id=\"attachment_4337\" aria-describedby=\"caption-attachment-4337\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-01_12_2016-10_31_02-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4337\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-01_12_2016-10_31_02-PM-300x163.jpg\" alt=\"Unity 01\/12\/2016 , 10:31:02 PM Unity Personal (64bit) - P0Main.unity - New Unity Project - PC, Mac &amp; Linux Standalone* \" width=\"300\" height=\"163\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-01_12_2016-10_31_02-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-01_12_2016-10_31_02-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-01_12_2016-10_31_02-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/12\/PhoenixGameDevelopment-01_12_2016-10_31_02-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4337\" class=\"wp-caption-text\">Unity<br \/>01\/12\/2016 , 10:31:02 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone*<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have had to abandon the idea of using the existing colour-based rendering\/texturing system. I can&#8217;t find a way to send the data that I need per pixel, only per terrain chunk, which wouldn&#8217;t work (I could render each chunk with a different texture, but not each individual pixel, which would look terrible). I will [&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-4353","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\/4353"}],"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=4353"}],"version-history":[{"count":4,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4353\/revisions"}],"predecessor-version":[{"id":4389,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4353\/revisions\/4389"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=4353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=4353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=4353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}