NEWS

Master your own destiny! Command a nation!

Fast Terrain Vegetation

After trying many different approaches we have implemented a new routine for drawing grass and cornfields on the terrain. The routine we have used so far has a few issues that we were not happy with. It is very hardware intensive which means that it can only be drawn close to the player and not in the distance. This is particularly bad when it is used for cornfields and high grass. Players will crouch down thinking that they are in cover in a corn field and in reality everyone can see them and shoot them.

The new routine draws grass and cornfields all the way to the edge of the map. It is not as pretty as the expensive one but it have a major advantage in that it supports the gameplay. I personally think it’s a good tradeoff. I still use the expensive system on top of the new one to give variation.

 

The Texture

The system is very easy to set up. First I create an image with all the different grass and corn textures. To be able to adjust the resolution of the textures later and support hardware with massive amounts of memery, I create the grass and corn in XSI and render it to the texture. I use the FxTree to composite the different parts onto a common texture and adjust colors etc. (for instance, the grass looks way better if I use the ‘terrain grass texture’ (the one mapped on the ground) as masking background).

Rendering the vegetation texture in XSI

The texture holds 4 different types of vegetation (Grass, Corn, River plants and eehh, death cones from space (I have not used the 4th yet ;-)). All vegetation is combined on 1 texture to increase speed. Usually speed comes at a cost and this time it is resolution. In the current build this texture is 2048×2048 (which normally is quite high resolution), but I will increase the resolution if it is possible, but one focus we have with Heroes and Generals is that we take care not to bloat the download to several gigabytes.

Texture used for fast vegetation rendering

 

 

The Terrain Mask

The reason for combining all the vegetation on 1 texture is that we can get the full benefit of the masking. A large masking texture is created in WorldMachine where the R, G, B and A channels are used to control vegetation type and a color tint.

Vegetation Mask and Control Property

The amount of red, green or blue controls a color tint that gives the vegetation a bit of variation and makes it blend into the terrain a bit better (the routine is fast but produces som very noticable artifacts).

The control also allows for setting some variation on the size of the vegetation.

 

Details

This setup produces very uniform vegetation that covers large areas of the terrain. This is good for the base but it needs some more to look good, which is why I add patches of plants on top.

This is done using XSI’s ICE system. The ICE system is a clever node based system for controlling alot of different things  (particles, deformations, physics and modelling). It is a bit more difficult to master than just using prebuild operators but way easier than writing scripts or plugins. (It is the reason why you should switch to XSI and leave Max/Maya in the ditch ;-).

I use the same masks (and some more) to distribute particles on the terrain. These particles each control where a patch of grass is drawn on the terrain.

XSI ICE tree for distributing detailed vegetation patches.

The grass patches is constructed as normal geometry and conformed to the terrain once in the game.

Detailed Grass Patch

Ofcourse all these images are from work-in-progress and I will continue refining the terrain and vegetation as the game development progresses  and as always ideas and suggestions from the community is welcome.

 

  1. avatar11_Harley_1111-02-2011

    Looking fantastic!

    It’s great to see you guys using and promoting XSI too, it really doesn’t get the attention it deserves.

What are you waiting for soldier? We need heroes on the battlefield and generals to lead them!