Submitted by , posted on 03 December 2002



Image Description, by


This is my 4th contribution to flipcode's IOTD, although the last one was more than a year ago :) I've been working on real-time soft shadows during my free time recently, and couldn't resist posting an image of my results.

The technic is based on a render-to-3D texture approach. It's based on an extension of shadow volumes, which means it handles self-shadowing and point lights perfectly. In a first pass i render the shadow volumes to the first depth of a 3D texture, and i then blur the next depths recursively in hardware. When it's done, i calculate a "sharpness" coefficient per-vertex, which takes into account the distance to the viewer and to the light, and i render the scene again, with the full lighting equation, modulated by the 3D "shadow map", which i sample based on the sharpness coefficient.

It's not perfect, but the results look pretty decent. The demo from which these images were taken only works on a Radeon 8500+, and run at 15-20 fps average on an Athlon 1.4 Ghz. It uses vertex shaders and pixel shaders, for shadow volumes extrusion, dot3 bump-mapping, specular and gloss-mapping. The CPU is almost idle, if it wasn't for rendering the environment bump-mapped water (requires render-to-texture too). The bottleneck is coming from fillrate, but surprizingly, not from the soft shadows part. Tested with standard shadow volumes, the demo runs at 20-25 fps average, which means the soft shadows is only slowing it down by 20-25%. The scene is not very complex, but also not obvious (around 15k tris).

Two DIVX videos are available on my website:
http://www.fl-tw.com/opengl/SoftShadows/

I'll try to post the executable in a few days, plus some source code. No Geforce 3/4 convertion is planned at the moment (no time!).

F. Brebion



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