Code for Drop shadow effect?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
theHobbit
Posts: 65
Joined: Sat Sep 30, 2006 5:26 am

Code for Drop shadow effect?

Post by theHobbit »

Hi there, could anyone post the code to make a drop shadow effect of an image or sprite please?

Thanks in advance
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

shadows for dummies:
1) draw your sprites as hardware accelerated rectangles
2) first draw the shadow at x+displace, y+displace being x,y your sprite position and displace a const to adjust: draw your shadow drawing the sprite specifying black/half transparent as each vertex's color
3) draw your sprite at x,y
Considerations: if you need a basilar 2d environment then disable z-buffer...BUT z-buffer can give you layers organization _for free_. If you wasn't speaking of 2d shadows but of 3d ones, then you have a looooong way to walk. If so, start learning algorithms, not code: A nice place to learn this kind of algorithms is www.delphi3d.net (quite out of date, but full of interesting and easy to understand articles)
Post Reply