Tips for rendering foliage

Blitz3D Forums/Blitz3D Programming/Tips for rendering foliage

JoshK(Posted 2004) [#1]
I am working with one of my artists on trees and bushes. I came across a couple of things that makes real-time foliage look a little better. It's not exactly stuff you normally consider, so thought I would share.

I am using Red Orchestra as a guide. My goal is not to make the highest quality plants possible, but rather to get a good mix of quality and speed, so that I can render a large area covered in fairly dense foliage.

Due to z-ordering issues, I am only using texture masks, not texture alpha. All branch pieces have backface culling disabled.

Here is my first attempt. As you can see, it is very horrible and ugly:


The lighting made it really obvious the bush was made of planes, so I made the material full-bright, figuring I can just lighten-darken the bush per mesh. The planes facing to the side from the camera view are still very apparent, mostly due to the mipmapping:


Next, I turned off mipmapping. It gives a more grainy look, but the bush now appears as a round mess of leaves:


I am not happy with the intensity of the mipmap blurring on the terrain, but can't do anything about that. Using my texture shader lib (available somewhere on here) I added a "sway" shader to make the bush texture slowly move around in a sinus circle. The result is moving, real-time brush that can be created at a high density.


N(Posted 2004) [#2]
Nice, still needs shadows but the lack of them is likely due to you having not lightmapped the level at all yet.

Good tips, definitely.


JoshK(Posted 2004) [#3]
The trees will use projection shadows under them. I am hoping I can get away without any sort of shadows under the bushes. I'm actually planning to use vertex lighting only on the terrain.


N(Posted 2004) [#4]
Should be interesting to see how it works out. In my experience it has always been best to vertex color the terrain via based on the positions of virtual lights (in order to decrease overhead from the calculation of each vertex's 'new' color).

I think small blob shadows would be good for the bushes at the least, because right now they look like they're hovering.


Tom(Posted 2004) [#5]
Good tips.

Have you seen the foliage in Joint Operations? Thick, lush foliage, simply delicious!

http://www.3dgamers.com/screenshots/games/jointoperations/35.html
More here:
http://www.3dgamers.com/screenshots/games/jointoperations/

I wonder if they're using masked textures? Also, their grass LOD system is so damn good you need to look hard to see the blend switching.

And just about on topic...
One of the neatest touches in that game is when you're scoped in on a soldier far away who's laying prone, although the grass may not be drawn (because you're not zoomed in 'that' close to see it), the game engine blends (or textures) the soldier the same as the ground he's laying on, making him/her very tough to spot. That's what you call attention to detail!

Tom


JoshK(Posted 2004) [#6]
That's pretty nice foliage.

Here is another comparison of mipmaps and no mipmaps. In the mipmapped texture, the black mask creeps in and darkens the image. It also become apparent that the bushes are made of planes, since the faces that point sideways are blurred to a solid green color:



Without mipmaps, the foliage is grainy, but looks better overall.



N(Posted 2004) [#7]
Interesting.

That one game, Tom, has some quite nice foliage.

I've been trying to get some decent foliage sprites (and I plan to implement some sort of single-surface mesh system for Ulysses, it's ridiculously easy) made for my grass system so it can be used for more than just grass. I just can't figure out how the heck to draw them.


Beaker(Posted 2004) [#8]
Out of interest: what is WorldEdit?


JoshK(Posted 2004) [#9]
CShop5. I like WorldEdit better, but am going to stick with "Cartography Shop", since people know what that is.

The artist is redoing the bus texture to make the leaves larger and less grainy.