Rendering 2D Shadows for Convex Shapes

Posts: 1,066
Joined: 2004.07
Post: #16
Skorche Wrote:Are you alpha blending the light values? Just add them.
That certainly helps my shadows. The lights are still wonky though.

OneSadCookie Wrote:
render scene to depth, and ambient light to color buffer
for each light
    clear the stencil buffer
    render the shadow volumes to the stencil buffer
    render the scene to the color buffer, lit by the light, with
        * depth test set to equal; and
        * depth writes turned off; and
        * additive blending enabled

I'm going to try implementing that either later tonight or tomorrow and see how that goes.
Quote this message in a reply
Posts: 26
Joined: 2006.09
Post: #17
There was an article in some time ago on the subject, you may want to check it out:

As for the original problem regarding the extrusion distance, you may want to try to extrude the back-faces instead. Additionally limit the light radius and extrude the shadow edges to the bounding box and use part of the bbox to complete the shadow shape. The downside is that that may result nasty non-convex polygons to render.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Vector shapes Miglu 16 12,260 Sep 22, 2010 07:52 AM
Last Post: Miglu
  Window drop shadows NelsonMandella 9 8,300 Mar 21, 2010 02:34 PM
Last Post: NelsonMandella
  Making 2D Stencil Shadows Soft metacollin 16 20,536 Jul 22, 2009 01:59 PM
Last Post: NelsonMandella
  softening 2d shadows NelsonMandella 5 6,020 May 19, 2009 04:19 AM
Last Post: Najdorf
  Breaking down a concave mesh into convex pieces Willem 5 6,389 Aug 10, 2008 05:49 AM
Last Post: Willem