DEVELOPER'S BLOG

Arma 2 Vegetation progress

vegetace_strip.jpg


Currently, we're finalizing trees and bushes for ARMA2. The biggest problem with vegetation is impact on game performance, so we develop a lot of new techniques on the side of the engine and on the side of LindaStudio as well. We make very deep analysis of performance problems in Armed assault and we find, that the main problem is overdraw in the first 20 meters of the scene. So it means, we needed to optimize the overall surface of trees and bushes and develop some more effective shaders and drawing techniques in the engine to reduce these aspects. So what did we do?



New trees can use a more accurate representation of "polyplanes" (geometry for replacing hires branches) this reduces the overall surface by about 30%, but increases the amount of vertices. We teach the engine to use double-sided faces to reduce this increase of vertices on vegetation models.


New shaders


The original trees used shaders that use texture, normal map and two maps for diffuse and ambient attenuation, that means four stages. Now we use a special tree shader with texture, normal map and macro map. This macro map has colorization information in the alpha channel as well as in RGB ambient lightmap. This solution gives to the artist a better overall control on a tree's look and saves one stage, that makes this shader faster and the trees are better looking then previous ones. We also developed a shader using a technique known as "pre-computed radiance transfer", that we want to use for far vegetation lods (this technique needs just two stages). All these new things required changes in LindaStudio. For example to have the possibility to generate multiple UVs on trees, export to formats that will allow render lightmaps in 3th party graphic software etc.


Changes in engine


The ArmA2 engine is able to use a method known as Z-priming, all vegetation is very quickly drawn with a simple shader as mask with transparency and the second step is to draw only non-masked pixels with a complex tree shader, this helps a lot to reduce overdraw and allows us to use more complex shaders in the future because it decreases performance dependency on shader complexity and model surface.


From measuring we learn that sometimes it's better to use hi-poly trees with the smallest surface, then use lods with a small amount of face but with a bigger surface. We develop tools to measure these parameters in Linda and allow the generation lods of vegetation to reflect these aspects.


Also new models of vegetation use a better algorithm for optimal using of vertices in plant structure, to reduce the performance impact on vertex shaders.


Visual aspect of vegetation


Armed assault used generated trees based on scripts version 1.5 (OFP elite used 1.0). ARMA2 uses the 4th generation of scripts, that allows us to generate much more realistic branching, more effective geometry representation (with ArmA it was not possible ho have life-size trees due to the performance impact), root system, correct leaf colorization, solitary branching with real like density, most of the control over trees is now based on real botanical aspects.


vegetace_sshot.jpg


So, the last things for ARMA2, that's waiting for us is the automatic generation of special geometry, such as collision, view and fire geometry. This was always made manually and meant that often it was not precise enough for shooting, or the AI were able to spot you through vegetation. I hope that this last thing will be solved soon in a few weeks.


Clutter (grass surfaces)


From lessons that we learned about the performance impact of trees, we developed a new way of making a grass model that is more effective for drawing than in Armed Assault but looks much denser and better visually. This is also based on the knowledge that in the first lods we must target on surface reduction and in far lods on vertex reduction, because far lods are drawn with a very limited amount of pixels.
There is also a nice change in the engine, where we can now particularly colorize vegetation clutters by satellite map, this allows us to produce non-repetitive surface with a more realistic look that naturally fits to the landscape (see results in the picture at the top of this article).


Future


vegetace-linda-lowres.jpg
Click here for high-res screenshot (730Kb)


The immediate future will see us finalizing all key needed models and "tree" technology for ARMA2. After that, we will work on general polyplanes. That means, polyplane could be any king of geometry or model, controlled by O2 script. This will again help a lot to reduce the surface of trees, also it will give us better tree shape and less visible lod switching. This technique will also give us the possibility to have blossoms, fruits or other special geometry on trees. We'll also continue with geometry optimization, and making better control over tree growing.
Also it will be very important to have a more open pipeline for tree texture rendering, to allow render translucency, lightmaps and precomputed radiance transfer maps directly in LindaStudio. Development of a system for automatic generation of special lods is the first step towards a more general system that will one day allow tree skeleton creation and also a future system for physical interaction with vegetation.

Published on