Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / a plain and simple shadow library

Author
Message
DarkDISCUSSION
15
Years of Service
User Offline
Joined: 6th Jul 2011
Location: Ft Madison, IA
Posted: 20th May 2012 00:54 Edited at: 20th May 2012 01:00
Hi!,

is there a nice shadow system that works with dbpro?
im trying to make a 3d version of my pong clone:

The only problem is that I dont have a clue how to add shadows to the game. Is there a shadow library for this sort of thing? (preferably *free/GPL*)

Code like an indie who is a brain sucking troll that even superman cannot step away from his code to save you!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th May 2012 02:36
There are all sorts of shadows, mostly 3D. 2D shadows are less common.

revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 20th May 2012 12:42 Edited at: 20th May 2012 12:52
Depending on the type of background (the shadow-receiving objects) you could possibly fake the effect using transparent or ghosted plains, but this looks to be a case where dbpro's native stencil shadow commands could work nicely as well.

By default the shadow system is point-light based, but with a simple modification the shader can be converted into a directional lighting system.

Another option would be shadow mapping (of which there are many examples available here on the forums and Evolved's site)

Edit: Another thing to note is stencil shadows cannot be used to accurately represent transparent objects, so if you require that particular feature I'd suggest looking into faking the shadows or using a shadow mapping shader.
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th May 2012 13:06
Green Gandalf has been posting quite a few shadow mapping examples recently. I'd take a look at some of his shaders. I was also planning on post up a really simple shader example too. The idea of writing you own shadow shader is quite intimidating and I've avoided it for quite a while, but once I actually sat down and tackled the problem (looking at Evolved's shaders to learn from), it's really straight forward.

I promised Andrew Neale I'd explain how I did mine a while ago, so I'll try and get some sort of basic explanation post up soon. Maybe later today if I have time (probably not!).

Login to post a reply

Server time is: 2026-07-22 00:35:26
Your offset time is: 2026-07-22 00:35:26