Quick shadows

Community Forums/Showcase/Quick shadows

Kalisme(Posted 2010) [#1]
I sort of stayed up tonight (first day of class today, I should of been sleeping!), and I slapped together this from the shadow code I put in the code archives ages ago.

I remember some people being annoyed that it wasn't coded as usable functions instead of the badly written tutorial... So I think I'm going to add an actual library in the code archives when I clean and fix this up...

This is much simpler and faster (I think... not really sure) than the "shaKAL" library I wrote years ago... I think it looks nicer too. I was inspired to go back and look into the code because I recently saw the "ombres" shadow library for blitz... it was the fastest and simplest one I have seen. So when I looked through it I noticed one big thing that sped it up was lack of recreating meshes and instead just copying them without culling... I was too lazy to learn how to use the library (plus I don't like using other peoples libraries... I worry it'll make me lazy), so I started coding a new library.

This example is has the library just badly slapped into the code, I'm still cleaning it up, so please don't judge me by my messy coding. If there's any interest I'll gladly post the library as open source. My mane goal is to keep it really simple... Not even worrying about blurring textures or anything. I figure it might work nicely for casual games and so on.
Anywho, ahem:



Oh, and by the way; this is for blitz3d.
I know there's alot of shadow stuff out there that's more fancy than this, but it was fun to code. Hope you like.

Expect the finished library very soon.


Oh, quick add:
it was just pointed out that this is a bit "choppy"... If so, try changing the line:
Global ssize=128
to
Global ssize=64
(or 32)

Or keep it at 128 and remove a light source by removing this line:
create_light(light2,5000)

Well, I'll see if I can get the next release faster ;)


Nate the Great(Posted 2010) [#2]
nice job, unfortunately it is too chopy for a game.


Kalisme(Posted 2010) [#3]
yeah, I think something isn't getting cleared from memory... should be able to fix it though, plus this demonstration uses two light sources... Alot of blitz3d shadow libraries say not to use more than one... I shouldn't of used more than one, but I figured "meh, I'll give it a go". That and the shadows are 128x128... lower base 2 numbers are a bit smoother. I have have to add a few simple speed up tricks and fix up some of the code, but I think I did ok so far for one nights work.


Nate the Great(Posted 2010) [#4]
well that speeds it up a bit. Still wouldnt work for an FPS... maybe an RTS or RPG good work anyway. perhaps you should put this in the code archives?


Kalisme(Posted 2010) [#5]
I figured I'll fix up the code a bit before I post it...
try to speed it up, get the brush texture part working better (so it works better with lightmapped meshes), clean up the code and then I'll post it as an include library in the code archives.


jfk EO-11110(Posted 2010) [#6]
Anyway, thanks for sharing. Just saved locally.