create a shadow volume

Blitz3D Forums/Blitz3D Programming/create a shadow volume

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Off topic: Don't you need shaders to pull this off? I didn't know Blitz allowed shaders?


Actually it's possible to do a kind of stencil shadows in plain blitz3d, if you once got a proper shadow volume, it can be done, tho without to access the stencil buffer, but basicly it's the same as stencil shadows.

Eurythmia released a little demo some time ago that demonstrated the trick. It had no shadow volumes, but it used a fake volume mesh.

It works this way: everything in the level is painted grey, 128,128,128 Only the shadow volume is say 64,64,64. Now when the shadow volume has EntityFX 17 and alpha 0.5, there will be two possible colors, byside the background color: 32,32,32 (that's where the renderer had to go through shadow volume faces only one time) and 16,16,16, (that's where it had to render 2 layers of faces: outer side and inner side). Practicly this results in zones that are intersecting with the ground etc. that will be 32,32,32 and zones that are not intersecting (16,16,16 or 128,128,128). The rendered screen is then grabed and Drawimage is used to draw the intersection parts only (using MaskImage).

Of course this could also be done using a semitransparent pixelperfect sprite that is covering the screen.