Shadows

BlitzMax Forums/MiniB3D Module/Shadows

Zenn Lee(Posted 2007) [#1]
I am very new to MiniB3D, so I may sound kind of dumb but, how do you add shadows? When I shine a light over a mesh over a plane it doesn't cast a shadow. Sorry again if I'm asking a very simple question but I would very much appreciate the help.

Thanks


bradford6(Posted 2007) [#2]
I'll start off by saying welcome.

first:

Shadows are hard. They are mathematically intensive and computationally expensive. miniB3D does not have a built in 'shadow' method (mainly because it is designed to be compatible with older graphics cards and machines and shadows sometimes used more advanced GPU features)

second:
user Klept02 has created a miniB3D module extension that uses shaders and has some shadow routines in as well.

also, check out http://www.blitzbasic.com/Community/posts.php?topic=63491
t=it should give you some info on shadows.

there are some shadow examples in the code archives. (written for Blitz3D but easily converted to mininB3D)


klepto2(Posted 2007) [#3]
There are different methods to achieve Shadows:
- Stencil Shadows
- ZFail
- ZPass (better known as Carmacks Reverse)

- Shadow Mapping

these are the common ones nowadays used.

They both have advantages and disadvantages.
The Stencil Shadows needs a lot of CPU time because you have to calculate the whole shadowvolume. But therefore there are detailed selfshadowing with no really additional work.

Shadow Mapping is instead a simple depthmap technique where you have to position the Camera at the position of the light source and then if you render the scene to the dephtbuffer. After that you have to render scene normal and lookup in the
'shadowmap' where you have to render the scene shadowed. These has the advantage, that you don't need to know anything about the scene geometry, but therefore you may have to du antialiasing for the shadow as it would look pixelated without.

In my current Version I use Stencil Shadows with both methods (ZFail/ZPass) integrated. Currently I try to write a shader to pass the shadowvolume calculation to the gpu which is a lot faster than doing it on the CPU.

The release is delayed a bit, as I have unfortunately not that much time currently. But If you want to look how the shadows look like in Game (well better in demo ;) )

http://www.myvideo.de/watch/898684


Difference(Posted 2007) [#4]
You can get an old demo I made of the shadow maps method here:
http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=peter__scheutz04032002142220&comments=no
(no source, but there are examples in the code archive)




Zenn Lee(Posted 2007) [#5]
How about gile[s]. This prerenders the shadows right. How would I render the shadows as the game is running. (That is what todays games do, right???)

How did this guy do his shadows, it looks GREAT!
http://www.blitzbasic.com/gallery/view_pic.php?id=1227&gallery=hr&page=1


Picklesworth(Posted 2007) [#6]
House of Dark's shadows there are static shadows rendered with Gile[s]. (I do not know if there are dynamic shadows as well, but if there are I bet they're done with sswift's system).