Well, imagine it this way. Every foliage instance is going to be a flat model, 2 polygons, square (Or rectangle depending on the type), at a slight angle so that it looks fine from above. Simple. In old style lightmapped based engines, you could easily botch the lighting to make it look ok (Think Farcry, which uses static lightmap based radiosity), not only that but you could use better blend funcs with a custom blend mode so they textures didn’t look so bad. In other words, you could stand back, look at your grass, and it would look good, blend nice, fade out quite decent, and be pretty much uniform in lighting. Simple…?
Now in Per Pixel Engine games its a different story. For a start you cant just go throwing fill rate around so you save some performance on using alpha testing. Alpha testing is just like Alpha blending, however it produces hard edges to the alpha mapped surface, thus making even the nicest alpha blended picture look poor (Look at the latest “snow” shot with the walker, see how hard the edges are on the foliage?). Now, as it stands you pretty much need to use alpha testing to get lighting on your foliage surface, otherwise the texture will glow, and be seen in the dark, i.e. not look good at all. You can use alpha blending, with a custom blend mode, that will be affected by light interaction but that’s to slow atm, so we stick to alpha testing. That’s all well and good. I don’t mind using alpha testing. Its ugly, sucks at long range because its so hard on the eyes, but if I have to I have to.
The actual surface texture is not the problem…
The problem is how i started my description. Foliage models are just flat, “billboard” (but not sprite) based models, at a slight angle. Pretty much just a flat square sticking out of the ground. Each of these are placed on the surface with a random rotation, and a random origin, so they spread out quite nice, and they can be seen from all angles. but this is where the problems start…
First of all, you cant use twoSided on your material stage for a foliage instance. This is because once you do, the normals data becomes wrong for the one side, and it will NEVER look correct. So, you have to take your model, duplicate the polygons and invert the normals. This means that now a simple glass model is 4 polygons, but each side has its own lighting info. The problem however lies in the placement.
Think of a box room, with grass on the floor. Each of these grass instances has a random rotation as we know. Now, think of the sunlight coming from a single corner in this room. You also have an ambient light in here, dark, covering the entire room to fake some radiosity. So you got your foliage and your light source/s. What will happen? Well, the light will shine down onto the grass, right?
Correct. However, because of the “random rotation” seed we use for the grass, this means that EACH model instance will be affected by the light independently, and thus, differently. Sounds correct so far. However what that produces, is each grass instance will be lit slightly different, and so, what you actually are left with, is some grass being very dark, some being very bright, and a VERY uneven looking scene to the grass.
Its hard for me to explain it really without using pictures, so ill try and do a few test shots for you later showing the problem.
Reason I bring this up here is obvious, ET:QW is a per pixel game, with the exact same idea of foliage over terrain, but in each and every shot I have yet to see this kind of problem.