Fake realtime shadows

Hello everyone! I have discovered an interesting way of having “realtime” shadows in the game engine.
ASWD movement of cube in game

I hand-painted the shadows so they do not look very good. The shadows can run 3 times faster (or more) than normal shadows. For a simple on-the-ground game this technique could be very useful.

The way I was able to do this was by using an alpha texture and have global mapping for it.

Please give input on how this shadow technique could be improved.


Prebaked shadow and light maps were often used in older games, but this has the drawback that you can’t animate lights nor the geometry. There’s a wide variety of ways to do shadow mapping these days, maybe check out this article for more information: http://en.wikipedia.org/wiki/Shadow_mapping .

Instead of Painting them by hand you can also use blender render to generate them for you.

Well, with this method, you can actually change lighting by fading off the shadow map via IPO editor. Plus, I made this so that the cube/s you see are actually affected by the the shadow. They can move around and aren’t just baked into the environment.

I will be looking over this when i reach my pc,i am really curious.

Clever, it is basically a decal, you can change the direction of the shadow using an empty, and map to object instead of global.

http://cgcookie.com/blender/2010/05/19/tip-placing-decals-with-empties/EDIT: Oh wait, it doesn’t work in BGE…

I got to say that its impressive,too bad it works for plane surfaces.

Yeah, that’s a nice technique. It works fairly well, actually. I did something a bit cruder with Python awhile back where I got the color underneath the player and adjusted its object color accordingly. Very nice work.

BGE could really use object based texture mapping.

I’ll try to see if there is a way to have it work in more complex environments.

I see how that might be done. I think that this technique could work for lights/lighting as well as shadows.

Thanks for the comments! If anyone needs me to post some kind of tutorial I can!


Nice. Just what I needed.

what about using a sphere with collision detection that knows which vertice was closest, the “Light” spawns every X frames, scales up each frame, and on collision it lights up using vertex color, and then reduces the vertex color level, this would cause shadows, and on each scale up, reduce the value of each vertex color, so
iteration 1 - Color = <1,1,1> - collisions
Iteration 2 Scale=Scale+X, color equals color - <Falloffx,Falloffy,Falloffz>-new collisions
and so on.

think it work?

also the verts could be blacked out on collision, rather then just lowered,

Glad to be of service to you!

I’m not a programmer (hence, why I look for optimizations), but I think I know what you are talking about. For low-poly models it wouldn’t look very nice, but I’m not sure about performance for it at all. If you just lowered object color when it came in contact with a certain area, it would look good enough.


it would use the collision on the object to uv map a brush, so it would not be face dependable, so it edits an image based on a collision, only one image exists, that is edits each frame, so the map is the emission,
So we have, 1 fully lit uv map, 1 map that is added to it that is black when it starts, when particles strike the surface, you use that collision to place a brush that is a falloff, so enough particles = fully lit.