{"id":807,"date":"2011-02-26T23:05:14","date_gmt":"2011-02-27T06:05:14","guid":{"rendered":"http:\/\/the-witness.net\/news\/?p=807"},"modified":"2011-02-26T23:05:14","modified_gmt":"2011-02-27T06:05:14","slug":"grassing-it-up","status":"publish","type":"post","link":"http:\/\/the-witness.net\/news\/2011\/02\/grassing-it-up\/","title":{"rendered":"Grassing it up&#8230;"},"content":{"rendered":"<p>Since The Witness takes place in the outdoors much of the time, we knew from early on that we were going to want to have grass of some kind.  We added grass into the engine quite a long time ago (starting around December 2009?) and it's gone through several iterations of what-seemed-to-make-sense-at-the-time.  At this point, it is starting to be kind-of reasonable, so to spruce up the game a little bit for next week's conference, I started using grass willy-nilly around the world.  (You may have seen a little bit of grass creep into earlier screenshots, but prior to today it had been confined to very small areas of the island).<\/p>\n<p>Here's what it looks like now:<\/p>\n<p><a href=\"http:\/\/the-witness.net\/news\/wp-content\/uploads\/2011\/02\/grass.jpg\"><img src=\"http:\/\/the-witness.net\/news\/wp-content\/uploads\/2011\/02\/grass-512x288.jpg\" alt=\"\" title=\"grass\" width=\"512\" height=\"288\" class=\"aligncenter size-large wp-image-808\" \/><\/a><\/p>\n<p>It does not look shipping-quality, but then, almost nothing in the game does!  As the first results obtained by just slapping some pre-existing grass meshes down on the terrain without trying too hard, I find it highly encouraging.<\/p>\n<p>Note that grass doesn't cast shadows right now.  There are two reasons for that: rendering speed and aliasing of the shadow map.  I suspect we will try to make grass cast shadows before we ship, though, and if we make something good happen there, I think it will really boost the visual quality.<\/p>\n<p>The one piece of code that pushed the grass over the threshold into general usability is that it now has the ability to sample terrain blend maps.  (The terrain uses a blend shader, where a non-visible blend texture map controls the degree of mixing of different terrain materials.  This is becoming a common thing in 3D games; Uncharted 2 and Crysis 2 do it, among others.)  The grass can now peek at the blend map and reduce its density in areas of particular blend values, which is why in this screenshot that path going up the hill is free of grass.  This tremendously reduces the amount of manual tweaking required to make the grass not do obviously-bad things.<\/p>\n<p>However, the grass doesn't check for buildings yet, which means if you place a field of grass across the area of a building, the grass will probably stick up through the floor inside the building!  Fixing that is next on my to-do list, but it involves a lot of raycasting, so hopefully it doesn't make grass placement too slow.<\/p>\n<p>In the future I plan to try using this same \"grass\" system for other kinds of scattered ground objects (fallen leaves, twigs, small rocks, etc).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since The Witness takes place in the outdoors much of the time, we knew from early on that we were going to want to have grass of some kind. We added grass into the engine quite a long time ago (starting around December 2009?) and it&#8217;s gone through several iterations \u2026<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"http:\/\/the-witness.net\/news\/2011\/02\/grassing-it-up\/\">Continue reading<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,7],"tags":[],"_links":{"self":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts\/807"}],"collection":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/comments?post=807"}],"version-history":[{"count":5,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts\/807\/revisions"}],"predecessor-version":[{"id":1250,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/posts\/807\/revisions\/1250"}],"wp:attachment":[{"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/media?parent=807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/categories?post=807"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/the-witness.net\/news\/wp-json\/wp\/v2\/tags?post=807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}