Question regarding foliage lighting


(odium) #1

Hey, I’m working on a game called OverDose, which is very much the same in regards to ET:QW, but free. Using the Quake 2 Evolved Engine, we have so far important features such as Quake 3 map (and thus terrain) support, Per Pixel Lighting, md5 and foliage. There are many more features obviously but that’s not needed here.

Anyways, while making our terrain we noticed something very annoying… Its just impossible to make good looking grass. First of all, alpha testing must be used to get lighting on the foliage (Which is a problem in itself because of how ugly it is). Second of all, because the grass needs lighting information, we are assuming that every foliage surface has a local and specular map, like an average surface. However this is our second problem, as because the grass has random rotation it really looks quite bad combined with the lighting, even with a full level ambient light to fake radiosity.

So, i guess my question is can you share any info onto how your doing your foliage? Are you using un-lit surfaces? While unlit surfaces look a lot better with no alpha testing they also have the common DUH problem of being un-lit, and so stand out like a soar thumb.

Any help or info would be great thanks.

odium
Lead artist Team Blur

(Quick blurb about OD, http://www.quake2evolved.com/overdose is our site and to view a few bits of our work in progress check here: http://www.quake2evolved.com/blurforum/showthread.php?threadid=2689&referrerid=1 )


(ayatollah) #2

Umm…try the Map Editing section…


(odium) #3

This is about a game thats not out yet though, ET:QW. Not Quake 3 engine games. Because the lighting is so vastly different, nothing about old style lighting/foliage will help me :stuck_out_tongue: :frowning:

If i’m 100% honest, our map format is pretty much on par with Doom 3’s right now, along with lighting, models etc support.


(odium) #4

Anybody…?


(Nail) #5

I don’t think you’ll find the developers willing to explain their lighting before the game is released if at all, but I would wait till after release to ask them to give away years of work, just my opinion though


(Smit) #6

Want to post a screenshot of how the foilage currently looks? I have some suggestions but I’m not exactly sure of what you are describing.


(odium) #7

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.


(Hakuryu) #8

I would say it’s a problem with the engine you are using. Do you really expect to be able to re-create effects in a new generation title on an old modified engine?

Instead of creating grass by blades, why not approach it from a ‘patch’ standpoint. Like create a patch of grass that is a model with 3 planes setup like a small thin pyramid. Then from any direction you will only see the normal for the face (or faces) that you can see from any direction and not the back of the planes.

I’m thinking that once QW comes out, you will quickly learn how they handle this… maybe it’s time to work on something else.


(odium) #9

No matter, i fixed it. Thanks.

Hakuryu, the only thing ET:QW really has over our engine is Mega Texture. It may SOUND like we are using an “old” quake 2 engine, but we are on par with Doom 3 ATM, adding more every day.