See what's going on with flipcode!




 


Submitted by , posted on 26 February 2003



Image Description, by


"The Octagon" is my game engine project on which I have been working for the last 6 months, on and off. It displays Quake 3 bsp maps, Quake 2 md2 and Quake 3 md3 models. All are lit using per-pixel lighting and bump mapping, and all surfaces cast stencil shadows.

There are two classes of light available for use. The first are standard point lights, and the second have projected cube maps. These can be used to emulate spotlights and anisotropic light sources. Gross visibility testing is done using the bsp and frustum culling per sector. This is then refined by testing if each individual face is within the camera frustum. The same procedure is used to see which faces are lit by each light.

Firstly, everything visible is rendered with its decal texture multiplied by a small constant plus its emissive texture, in order to provide the base for adding light. Then, for each light, stencil shadows are cast for each object which the light influences, and then a hardware-specific codepath lights the surface.

After all of the lights have been handled, particles which emit light of their own are added to the framebuffer. Then, we loop through the lights again and draw any non-light-emitting particles (such as steam particles), lit by any lights which influence them.

The demo requires at least OpenGL 1.3 support and is available for download at: http://users.ox.ac.uk/~univ1234

Full source code is supplied with the demo.



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.