PDA

View Full Version : Static lighting in objects



Coluna
09-15-2003, 02:41 PM
Hi;
How is the models iluminated by static lights in games such quake 3? is it used ogl default lights? and about when a model is over a shadowed ground, it gets shadowed too...how is the information about static lights stored? thanx

Jan
09-15-2003, 03:25 PM
In Quake 3 dynamic lights are textures, which get projected onto the ground to add to the lightmap. OpenGLsī vertex-lighting would not be useful for this, because Quake 3 levels have usually as few polys as possible, so vertex-lighting would look crappy.
However player-models have a lot of small triangles, so itīs possible that they use vertex-lighting for those, but i donīt know this for sure.

About the shadowing from the ground: I noticed, that when a player in CS (and certainly Q3 too) walks onto a dark surface, than the whole model gets darkened. I think they use a really easy approach here. Instead of storing light/shadow-volumes, they just take the poly the player is standing on, and get the texel of the polys lightmap which is exactly beneath the player. The color-value of that texel is then used to shade the complete model.

This is a very efficient method. It is easy to compute and the results are really good.

Of course the shading is not correct. For example if a player stands in front of a window through which light falls, then the complete player will be dark, if he stands on a dark patch, even though is body or head should be brightly lit.

You can see this effect quite good. Walk around in CS and watch a modelsī shade pop darker/brighter when he walks onto a differently lit polygon.

Modern games as Doom 3, use very different approaches for all the lighting. Doom 3 calculates EVERYTHING on the fly. If you are interessted in their technique have a look at per-pixel lighting and stencil-shadows.

Jan.

Coluna
09-15-2003, 07:33 PM
Thanx jan ...