Submitted by , posted on 26 October 2002



Image Description, by


Hello coders, Remember my last iotd (Quake+bump)? I added soft shadows on top of it and here is the result.

This algo for soft shadows is:
  • fast: 30fps displaying a Quake III levels on a Duron 800MHz, GeForce 2MX
  • crappy
  • doesn't look that good
  • Basically, while creating the shadow volumes with the stencil buffer, I also compute a shadow attenuation based on the distance between the occluder and the pixel, and I store it in the Alpha value of the pixel color. That means that every polygon that is displayed in the Stencil buffer is also displayed in the alphas of the color buffer.

    Then when I am displaying a big dark quad on top of the screen to darken the shadow area, I activate blending based on the alpha values stored in the color buffer, and here is the trick!

    More screenshots at: http://tfpsly.planet-d.net/img/3d/Screenshots/Bump/



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