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).
Here’s what it looks like now:
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.
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.
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.
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.
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).