Realtime / Baked Shadowmaps (GLSL-Less) - 3/5/11 Update

Hey. So awhile ago I started a project to get a baked but real shadow map in the BGE, and I think I’ve succeeded.

The idea is basically that a baked shadow map will save resources, but no objects can be shaded with it. At the same time, the GLSL shadow lamp isn’t really good for wide areas. So, I came up with a way to shade the Player by testing where he is in the shadow map’s image, which is loaded externally via the bge.texture or VideoTexture module. This method is also Multi-texture mode friendly, meaning that even old computers can have a nice shaded level.

Here’s the link to visit the page for more information and the (2.5) example download.

The script function to get the color from the shadow map image is hereby released under an open license agreement for anyone to use for any reason, even commercial.


Thanks Joeman!
Note to self - save this post

That is great! Even for glsl games, because the cone of a spot lamp can be very limiting.

Have you tested it outside blender?

Very impressive…and sophisticated!
Thank you for sharing!

Thanks, everyone.
@Josip - Thanks for notifying me to this - it didn’t work in a runtime, only because I used Module mode for the Shadowmap script file in the blend file itself (it was in module mode). I fixed it now, though - the file is external, and should work fine. If it throws an error at you when you run the example, tell me and I’ll see if I can’t fix it.

Blender behaves funky on my PC so I can’t test it. I just warned you because I made something similar and had that problem.

Hm. What do you mean by ‘funky’?

My Graphic card burned out and damaged the Motherboard a little bit, I got overheating all over the place. I am running on some integrated graphics now and my processor temperature goes wild when I run Blender. Until I find a job and make a little money no more Blender for me. The weird thing is I can run almost any other application but not Blender 2.5, 2.4 sometimes runs nice.

It shouldn’t be too bad - I tested it in multitexture mode, and that’s what the screenshots are of above. If you wish to test it, maybe you could just open it to make a standalone executable from it?

I will try to work something out, I can already see many places where I can use this technique. Pathfinding is the first one I will try.

I am getting 2 errors in the console. I took a picture, I tried to fix it myself but I didn’t write it so I don’t know what half the variables and modules in the script mean. Please help, I really need this man.

Wow, I’m sorry - I completely missed this post. The problem is that you’re using Blender 2.49 - this is only available for Blender 2.5. Sorry about that - if you’re still checking this thread and not using 2.5 yet (which i recommend), I could make a version for 2.49.