{"id":2690,"date":"2016-04-14T16:49:55","date_gmt":"2016-04-14T15:49:55","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=2690"},"modified":"2016-04-14T16:49:55","modified_gmt":"2016-04-14T15:49:55","slug":"p-152-virtual-world-concept-update-110-custom-materials-and-shaders","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-152-virtual-world-concept-update-110-custom-materials-and-shaders\/","title":{"rendered":"P-152: Virtual World Concept Update 110: Custom Materials and Shaders"},"content":{"rendered":"<p>After a few slight issues, I have managed to get a custom material mapped to my terrain. This allows me to specify a custom shader, which I intend to use to implement &#8220;texture splatting&#8221;, which is basically a way to blend multiple textures together in a smooth, organic way, without leaving visible edges.<\/p>\n<p>This should allow me to texture the terrain based on the height value of each pixel, and implement normal maps, lighting, shading, and various other advanced techniques.<\/p>\n<p>The main change that I had to make to get this to work was to change my material definitions to custommaterial definitions in code. The rest was fairly simple. I was actually able to follow one of my old tutorials from <a href=\"https:\/\/phoenixgamedevelopment.com\/blogs\/index.php\/2013\/09\/28\/t3d-tutorial\">HERE<\/a>. I had forgotten a lot of the steps involved with custom materials and shaders, and that tutorial was very helpful. I just needed to add the line &#8220;#include &#8220;hlslStructs.h&#8221;&#8221; to the beginning of the vertex shader, this wasn&#8217;t needed previously.<\/p>\n<p>These images were taken after applying a basic &#8220;red shader&#8221; (and then changing the colour values) to the terrain.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2687\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_45_08-AM-300x195.jpg\" alt=\"P152_DEBUG 14\/04\/2016 , 04:45:08 AM Torque 3D MIT - P152\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_45_08-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_45_08-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_45_08-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_45_08-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2686\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_12-AM-300x195.jpg\" alt=\"P152_DEBUG 14\/04\/2016 , 04:47:12 AM Torque 3D MIT - P152\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_12-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_12-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_12-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_12-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2685\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_28-AM-300x195.jpg\" alt=\"P152_DEBUG 14\/04\/2016 , 04:47:28 AM Torque 3D MIT - P152\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_28-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_28-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_28-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-04_47_28-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2684\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_25-AM-300x195.jpg\" alt=\"P152_DEBUG 14\/04\/2016 , 05:06:25 AM Torque 3D MIT - P152\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_25-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_25-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_25-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_25-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-2683\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_51-AM-300x195.jpg\" alt=\"P152_DEBUG 14\/04\/2016 , 05:06:51 AM Torque 3D MIT - P152\" width=\"300\" height=\"195\" srcset=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_51-AM-300x195.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_51-AM-768x498.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_51-AM-1024x664.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2016\/04\/PhoenixGameDevelopment-14_04_2016-05_06_51-AM.jpg 1922w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a few slight issues, I have managed to get a custom material mapped to my terrain. This allows me to specify a custom shader, which I intend to use to implement &#8220;texture splatting&#8221;, which is basically a way to blend multiple textures together in a smooth, organic way, without leaving visible edges. This should [&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-2690","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\/2690"}],"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=2690"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2690\/revisions"}],"predecessor-version":[{"id":2693,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/2690\/revisions\/2693"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=2690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=2690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=2690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}