Grassing it up…

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).

38 Comments:

  1. Why not simply use the blend texture map you already have? Then you could simply make buildings off-limits for grass, like you do for the path going up the hill, w/o wasting time on raycasting.

  2. The game is beginning to look amazing – I can’t wait to see what you have to share at GDC. I’m praying for a release date!

  3. Will you guys be able to ensure that the PS3 version will have AA & V-Sync?

  4. Looking good, can’t wait to play it! I know you say nothing in the game looks shipping quality but it still has a certain charm about it :)

  5. I’m currently trying to create a small engine within my uni course, and I’m using blend shaders for the texture (and hopefully some of the geometry to an extent) and have found them extremely useful?.
    as for the buildings, couldn’t you just project the building flat onto the map that controls grass growth?.
    am I right in assuming the shader that controls the grass takes in the value of the blend map, and within the vertex shader decides whether or not to draw?, or scale?

    Anyway, the project looks amazing so far (LOVE THE LIGHTING MODEL), and It’s been a real inspiration for me!. Thank you so much!

  6. hey, don’t forget to take pictures at the event to post here. we want to know how it went, since we can not go ourselves…

  7. Looks pretty! It’d be nice if you could have more variance of color in there too- maybe some nice flowers in addition to the grass, or even some fruit on the trees.

    Oh, and does the grass blow in the wind? Same for the trees, the clouds, and of course, that windmill.

  8. Looking good!
    Its really nice to be able to follow both the tech and the concepts developing, some designers seem to assume that the two processes are somehow totally independent, but the tech provides the communication channels so of course its intrinsic to the concept, at least in terms of realising it.

    I’ve just been implementing grass scattering myself, on my procedural voxel terrain system, its amazing how much it helps to add scale and detail to low poly mesh terrain areas.

    “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.”

    Could you just write into the terrain blend map in the footprint of buildings, so the grass placement will read exclusion zones from there too :) is it on a windy shader yet too?

  9. Tayron: I am using the blend map we already have, but buildings are not in the terrain blend map! If they use them, they have their own.

    taurus: I don’t know if there will be a PS3 version.

    Robert: To detect buildings / rocks / etc right now I am raycasting, and it works all right. I just wrote that post before I added that part. It’s not a big deal.

    The blend map detection happens in the editor; the shader doesn’t think about whether to place grass or not. It just gets told exactly where the grass is.

  10. Tom: The thing is that for workflow purposes it is much easier if you know who is in charge of the blend map. The way we are doing it now, the artist is in charge of the blend map and makes it in Photoshop. That is very clear and simple and we don’t have to think about if the game is also modifying the blend map by stamping buildings in every time we move them, and if we have to sync changes, etc, etc.

  11. “The thing is that for workflow purposes it is much easier if you know who is in charge of the blend map. ”

    Yeah makes sense, otherwise people overwrite stuff, version clashes etc. I forget that generally im a one man army :)
    Dont know how you are doing your lighting, but I ended up aligning the normals on my combined grass meshes with the planes the individual meshes were dropped on, otherwise I was gettting wierd harsh angular lighting on them when i had any source at a low angle.

  12. Mr Blow said: “I don’t know if there will be a PS3 version”

    How can you not know? Do you not have a PS3 dev kit?

  13. Can you tell something about the conference? (am i missing something?)
    Is it witness only one, or one on occasion of some other event?
    I understand, that some more secrets of the game will be revealed.

    Waiting impatiently to play The Witness :)

  14. hey, guys! check out The Witness’ twitter. I think Jonathan is gonna be giving updates through the whole events… not of the witness but of other announcements from other developers and games…

    he started with the new “magika:vietnam”

  15. but you could add the buildings to the terrain blend map & save some time :)

  16. I just wanted to ask, was the decision to build your own engine due to mostly concerns with keeping full rights and complete cross-platform possibilities, or was there a part of the game decision that required this over the standard game engines such as Unity/UDK?
    It looks incredible and I can understand building your own technology for this – I am mostly just curious if the game required any specific tech you felt other game engines lacked

  17. Most existing engines are pretty much terrible at doing open worlds. The good open-world systems out there are all things that people developed for their own specific games.

    On top of this, one of the technical backbones of our visual style, high-density lightmapping, is not something that is typically done by existing engines. They tend to focus on dynamic lighting.

  18. If you know what you’re doing and what you want, it’s usually better to code an engine yourself to do exactly what you want, instead of fighting against the api of an already made engine and stumble upon bugs/missing features for which you can do nothing about.

    For example both unity and udk have terrain features built-in that are worse (at least for a game like this)/different than the kriging method Blow used and it would be less straight forward to make a terrain that uses kriging in those engines.

    Also, I’m assuming, coding the engine is something jonathan and the team do enjoy.

    Although I do agree that for anyone else, unity/udk are great choices.

  19. @Puran — I don’t think you’d need kriging support in an engine … as long as you’re okay with having some separation between editing tools and engine, you can just use a custom editor to do kriging, and then export the result to an engine as a height map. Unless you want to make terrain editing a mechanic … hmm, could be neat …

  20. Yeah, but that is two tools and the result is less interactive than what I assume is in the witness’ editor.

    But yeah ok maybe the example wasn’t that great but you get the point.

    I just wanted to add that the high density lightmapping line is not exactly right. Unity uses Beast which is actually a really decent GI lightmapper.

  21. hey guys, i was watching this video: http://www.youtube.com/watch?v=Y-6EQo6it7Y
    and i realize i don’t know how game developers save their data in case of a crash or fire in the building or meteor crash and all that. so i wanted to ask you: how do you save your work? how do you save your engine and your code and your game? is it *really* like in the video? b/c it seems like over-doing and waay too expensive. is that really how its done in the *professional* world? and do you have render-farms or really expensive computers or drives or do you think that’s a bad idea, b/c i mean how does their stuff look so good b/c of their hardware or just alot of legit work in postprocessing? b/c i got their software, so it aint that!

  22. Film guys generate tremendously more data than video game people. They probably record up to 100GB of footage a day, whereas our entire game right now is about 1GB (after a year and a half of work!)

    So we are way more casual about data replication than they are. We do it just by having a server that runs our source control that is far away from everyone who is doing the work. So everyone individually has a copy of everything, and the server also has a copy.

  23. did you give a talk at GDC this year? i think i heard something from “SuperBrothers” guy saying that the best thing at GDC was your talk, but i don’t know if it was GDC2011.

  24. You know, a really nice idea if you don’t already have it is a weather cycle. One day it’s nice and cloudy, another day it could be hailing. Maybe. I know the limitations with it affecting the gameplay somewhat, but if it could be pulled off, it’d be really cool.

  25. I didn’t do any talks at the GDC this year. Was taking it easy.

  26. Hey Jonathan,

    I’m glad you’re not placing grass nonsensically, but it’s your game’s trees, not the grass, that had me subconsciously subdued. If you make the grass as interesting I may never go inside (or outside, irl) again.

    – Pritchard

  27. Hey Jonathan,

    I’m not sure if this blog is only for technical discussion about the game and I don’t know much at all about the technical side of things, but I just thought I’d say that the game looks amazing & I love the concept. The indie scene is really starting to get a lot of attention lately & it’s great to see developers such as yourself taking charge. I really hope the increasing interest is a sign of things to come.

    Anyway, keep up the great work. You already have a sale right here.

    • checker: Speaking of gt.tv, Jonathan Blow, Markus ‘Notch’ Persson, and I are going to be on the Bonus Round in April sometime. It was taped at GDC.

      hey, man! that’s cool! hope that guy geoff keighley wasn’t a fucking dick! make sure to post a link when its up though!

  28. Jonathan O'Brien

    Jonathan, I have a business sort of question. I was wondering, you have a studio of about 7 developers (correct me) at Number None – how do you fund this? I’m just curious as to how you continue to make games when (as far as I can tell) the only income you would have would be the royalties from Braid.

  29. O’Brien: Didn’t you just answer yourself? I’m guessing it’s with “the royalties from braid”.

  30. Jonathan O'Brien

    Yeah, but are the royalties from Braid enough to support 7 people’s lifestyles? I’m just interested, is all.

  31. The money coming in from Braid is still good. It is not Minecraft or Castle Crashers money by a long shot, but it is enough to pay for things at the moment. Once that tails off a little more, then I still have a good chunk of savings built up from Braid’s launch time.

    However, there aren’t 7 people working full-time on the game right now. There are just 3 (soon to be 4); other folks working on the game are in more of a part-time capacity.

    • hey, i had a question too! what kind of render… or shader? (i don’t know, render or is it shader?) are you using to out put the scene into the videogame? b/c the guys of battle field 3 were talking about *deferred*? rendering and lighting techniques that only modern games use to get the best results. you already mentioned you use terrain blend maps but to get the game looking so pretty what do you do to it?

      i mean b/c when they talk about technology they mention things like this… and plus! you *are* a consultant, right? so you are wayyy better than these guys! so what are you using?

  32. Jonathan O'Brien

    Thanks for the reply, Jonathan!

  33. Deferred rendering is typically used when you want to have a lot of dynamic light sources in the scene. We don’t need that — the lighting in The Witness is mostly static — so we use direct rendering.

    Deferred rendering also makes more sense on some architectures than it does on others. I could see us using it on some platforms if it makes sense there in the future, but it seems likely to me that our main renderer is going to stay mostly like it is now, which is a direct render (with a Z prepass, maybe).

  34. huh… when i google “high density lightmapping”, nothing comes up besides this article. what the hell is it? o_O

    but besides that – you say that most algorithms are bad at handling open world scenarios… i suppose the following one should be fine though? at least they supposedly were able to render a football field with 627 million grass blades with a geforce 7800gtx – at decent framerates: http://www.kevinboulanger.net/grass.html

    if you combine that with some distance-based culling, shouldn’t that work?
    but… i know little about engine programming and i guess you’ve probably already seen this and it doesn’t fit in your pipeline. still, i figured i’d post it because one of the things that i loved about braid was the amazing art style, so it would be lovely to have grass like this in “the witness”. though i have faith you guys will work things out somehow, i thought maybe this can help :)

  35. If you lighten the bottoms of the grass, make them less opaque at the bottom, or make them match the ground, it will look a lot better, but awesome nonetheless.

Leave a Reply

Your email address will not be published.