See what's going on with flipcode!




 


Submitted by , posted on 23 March 2001



Image Description, by


Some sceenshots of a dynamic light and shadows system I've been working on for some days now. The shadows are dynamic stencil buffered shadows and the system trys as much as possible to cut down the amount of shadow volume polygons generated in order to minimize fillrate dependency.

The pictures are:
Upper left - One dynamic lightsource with shadows.
Upper right - Its the same shot, but shadowing edges are outlined.
Lower left - 3 lightsources scene (R,G,B). It might be hard to see but there are really alot of faint shadows in the picture.
Lower right - The scene with lightmapping only.

It's still quite fillrate intense since the shadowing force me to do a n+2 pass rendering where n is the amount of lights. First I need to render lightmaps (This also initializes the depth buffer so you can do blending), then for every light I must render shadow volumes to the stencil buffer and then render lighting with additive blending and stencil testing. When done with all lights I render the textures with modulative blending. There are still some problems/bugs to overcome, for instance the entrance/exit of shadow volumes are bugging me. Since I actually render the shadow volumes they are also clipped to the near plane, but as you can imagine this creates somewhat weird results. It can be solved by setting the near plane to 0.01, but that breaks the Z-Buffer.

The performance is pretty ok (I think). Since my hardware sucks i sent a copy to a friend with a better computer and the one light scene run at 50-70 FPS on his machine in 800x600 resolution. The 3 lightsource scene runs at ~25 FPS on my computer in 320x240 (but my Viper550's fillrate is ~28 MPixels/s).

Well,I guess I could keep talking forever, so I better stop.



[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.