{"id":4677,"date":"2017-01-29T23:57:30","date_gmt":"2017-01-29T23:57:30","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=4677"},"modified":"2017-01-30T00:18:24","modified_gmt":"2017-01-30T00:18:24","slug":"p0-p-172-part-100-procedural-content-foliage-system","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p0-p-172-part-100-procedural-content-foliage-system\/","title":{"rendered":"P0-P-172: Part 100: Procedural Content: Foliage System"},"content":{"rendered":"<p>I have mostly finished my foliage system, for the moment.<\/p>\n<p>I have removed the 4 texture limit, and added the ability to add new textures or texture combinations by height, and vary their density.<\/p>\n<p>I was making a stupid mistake with the shader, which cost me some time. I was using the camera position instead of the vertex position, and I was wondering why all of my foliage types were changing at once.<\/p>\n<p>I believe there are still some memory leaks in the shader, and I still have new features to add, such as new texture types and values, and a &#8220;paging&#8221; texture system. This would allow me to swap out textures as the player moves around the world, so that I would only need to have a small number of textures loaded at once.<\/p>\n<p>Overall I am quite satisfied with how this worked out, I think it will dramatically improve the look of the terrain. Something that I really like about it is that I can render a LOT of foliage without any major performance problems (and I am running the game through the Unity editor!) this is exactly the result I was trying to achieve.<\/p>\n<p>The next goal is to add a similar system for trees, rocks, and other larger objects. The problem here though is that they will need to be in the same place for all clients. I intend to research various procedural content generation techniques in an attempt to generate the trees on each client using seeded random numbers. I have decided to move more towards procedural content generation on the client rather than the server, due to the issues that I experienced recently. The game will still be multiplayer, and I will still have a single game world which is explorable and modifyable by all players, but instead of doing most of the work on the server, I will simple be creating seeds and property values on the server, and sending those to the client for rendering.<\/p>\n<p>I now need to figure out how to create an entire forest based on a single seed, while also only processing the tree objects close to the player. IE, I can&#8217;t just generate all of the trees at once from the same seed, there would be far too many.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_4668\" aria-describedby=\"caption-attachment-4668\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-29_01_2017-01_43_08-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4668\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-29_01_2017-01_43_08-AM-300x163.jpg\" alt=\"Unity 29\/01\/2017 , 01:43:08 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\/2017\/01\/PhoenixGameDevelopment-29_01_2017-01_43_08-AM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-29_01_2017-01_43_08-AM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-29_01_2017-01_43_08-AM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-29_01_2017-01_43_08-AM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4668\" class=\"wp-caption-text\">Unity<br \/>29\/01\/2017 , 01:43:08 AM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n<figure id=\"attachment_4667\" aria-describedby=\"caption-attachment-4667\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_02_14-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4667\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_02_14-PM-300x163.jpg\" alt=\"Unity 27\/01\/2017 , 07:02:14 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\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_02_14-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_02_14-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_02_14-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_02_14-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4667\" class=\"wp-caption-text\">Unity<br \/>27\/01\/2017 , 07:02:14 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n<figure id=\"attachment_4666\" aria-describedby=\"caption-attachment-4666\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_57-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4666\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_57-PM-300x163.jpg\" alt=\"Unity 27\/01\/2017 , 07:01:57 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\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_57-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_57-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_57-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_57-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4666\" class=\"wp-caption-text\">Unity<br \/>27\/01\/2017 , 07:01:57 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n<figure id=\"attachment_4665\" aria-describedby=\"caption-attachment-4665\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_21-PM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4665\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_21-PM-300x163.jpg\" alt=\"Unity 27\/01\/2017 , 07:01:21 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\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_21-PM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_21-PM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_21-PM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-07_01_21-PM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4665\" class=\"wp-caption-text\">Unity<br \/>27\/01\/2017 , 07:01:21 PM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n<figure id=\"attachment_4664\" aria-describedby=\"caption-attachment-4664\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_04_16-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4664\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_04_16-AM-300x163.jpg\" alt=\"Unity 27\/01\/2017 , 05:04:16 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\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_04_16-AM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_04_16-AM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_04_16-AM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_04_16-AM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4664\" class=\"wp-caption-text\">Unity<br \/>27\/01\/2017 , 05:04:16 AM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n<figure id=\"attachment_4663\" aria-describedby=\"caption-attachment-4663\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-02_53_15-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4663\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-02_53_15-AM-300x163.jpg\" alt=\"Unity 27\/01\/2017 , 02:53:15 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\/2017\/01\/PhoenixGameDevelopment-27_01_2017-02_53_15-AM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-02_53_15-AM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-02_53_15-AM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-02_53_15-AM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4663\" class=\"wp-caption-text\">Unity<br \/>27\/01\/2017 , 02:53:15 AM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone*<\/figcaption><\/figure>\n<figure id=\"attachment_4662\" aria-describedby=\"caption-attachment-4662\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_03_55-AM.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-4662\" src=\"https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_03_55-AM-300x163.jpg\" alt=\"Unity 27\/01\/2017 , 05:03:55 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\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_03_55-AM-300x163.jpg 300w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_03_55-AM-768x416.jpg 768w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_03_55-AM-1024x555.jpg 1024w, https:\/\/phoenixgamedevelopment.com\/blog\/wp-content\/uploads\/2017\/01\/PhoenixGameDevelopment-27_01_2017-05_03_55-AM.jpg 1920w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-4662\" class=\"wp-caption-text\">Unity<br \/>27\/01\/2017 , 05:03:55 AM<br \/>Unity Personal (64bit) &#8211; P0Main.unity &#8211; New Unity Project &#8211; PC, Mac &amp; Linux Standalone<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I have mostly finished my foliage system, for the moment. I have removed the 4 texture limit, and added the ability to add new textures or texture combinations by height, and vary their density. I was making a stupid mistake with the shader, which cost me some time. I was using the camera position instead [&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-4677","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\/4677"}],"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=4677"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4677\/revisions"}],"predecessor-version":[{"id":4681,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4677\/revisions\/4681"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=4677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=4677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=4677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}