PDA

View Full Version : About lighting and lightmaps...



Anonymous Coward
12-15-2000, 08:14 AM
I was looking for info on how to implement lighting in a program. I found that lightmaps are good for static geometry. In a realtime simulation program (with static and non static geometry) how should I handle lighting? Games like Q3 and UT uses lightmaps for static geometry, what they use for lighting effects, player shadows, and player illumination?

Thx!

DFrey
12-15-2000, 09:38 AM
I'll try to answer these as best I can.
I don't know anything about UT, I don't have it. http://www.opengl.org/discussion_boards/ubb/tongue.gif So I'll answer what I know about Q3 and Q2. In Q3, there are 3 different types of shadows: blob, black shadow plane projection, and stenciled gray shadow volumes. The blob is just a texture of a blob projected onto the plane below the player using source alpha blending. The black shadow plane projection, maps the player model's polys onto the shadow plane and draws them as black polys without any blending. The stenciled shadows are created by drawing all the shadow volumes into the stencil buffer and then drawing one large gray quad over the screen using a stencil test and multiplicative color blending.
As far as lighting in Q3, Q3 appears to break that into four parts, dynamic lights projected on the world, dynamic lights projected on models, static light projected on the world, and static light projected on models. The world uses precomputed lightmaps for the static lighting. For dynamic lights in the world, a solid cylinder (Q2 used a sphere) is intersected with the world geometry and a set of dynamic light surfaces is constructed (assuming it does intersect and assuming the intersected surfaces allow dynamic lighting), then these light surfaces are drawn. Now I'm not certain if Q3 actually draws these light surfaces as additional polys, or if it does like Q2 and treats these light surfaces as lightmaps and blends them into the static lightmaps. I think it just draws them with some appropriate blending factor. The models are lit with software vertex lighting (not OpenGL lighting). The static light is derived from a precomputed 3D lightgrid that fills the world. The dynamic portion of the lighting for models is just added to the static portion based upon the dynamic light's distance, brightness, and direction.



[This message has been edited by DFrey (edited 12-15-2000).]