ATTENTION! The content of this article is more than three months old and may not be relevant to the current version of the game
Initially we wanted vegetation to play a role in the gameplay, eg. we wanted players to be able to crouch and hide in the vegetation. In most other games (at least in those I’ve played) the vegetation is clipped away in the distance leaving the ground completely uncovered. The effect would be that the player would crouch down thinking he would hide in the high grass, but in reality all other players would be seeing him crouching on a bare piece of ground.
We already had a vegetation system similar to what exists in other games, but performance got really bad as soon as we moved the clip plane further away from the camera, so I started to look into other solutions. I had some ideas that I needed an algorithm that would work somewhat like our terrain drawing, where the terrain would get coarser in the distance.
[singlepic id=287 w=540 h= float=] Terrain rendering getting coarser with the distance
So I started with a regular pattern that essentially would keep the overall structure across LOD boundaries, in order to keep popping artifacts at a minimum.
[singlepic id=288 w=540 h= float=] Terrain vegetation using a regular distribution
I tried various solutions to try and hide the obvious tiling, but none I could think of were good enough. I then looked into a different solution inspired by the paper by Kevin Boulanger http://www.kevinboulanger.net/grass.html, as can be seen on the screenshot below:
[singlepic id=289 w=540 h= float=] Grass rendering using the proposed method of Kevin Boulanger using his texture
And it worked really well for low vegetation like grass. But I wanted something where there was more variance in the visuals. So I went back to the idea of using a system like the terrain rendering but now I experimented with an irregular structure for the vegetation.
[singlepic id=290 w=540 h= float=] Irregular mesh structure for vegetation
And I felt it looked more chaotic which was what I needed to get enough variance. Based upon this method I expanded the method to allow for up 4 different kinds of vegetation packed into a single draw call. Below is a debug version that shows where the different types of vegetation would be drawn.
[singlepic id=291 w=540 h= float=] Different kinds of debug vegetation
And here is a screenshot showing the same scene with vegetation:
[singlepic id=292 w=540 h= float=] Terrain vegetation without anything else
And now the same terrain with everything else:
[singlepic id=293 w=540 h= float=] Terrain vegetation with the rest