The main problem is an idea. Technical solution is the second problem. As you see I changed only 4 lines of source, my first change was 1 line of code.
About speed. Lighting calculation done by CPU only. I have 3 GHz CPU and can't test that, but I think my improvement will not slow down the game. Function "isoccluded" very fast because it calls every frame many times. Light calculation happens only once - when map loads (or you edit light params).
Also you must know, that it is only "emulation" of shadows due to limitations of game engine. My code will not generate object shadows, it's possible only in Cube 2 engine. These shadows are "2D", so it is shadows only for walls, ignoring boxes or windows.
![[Image: vNzRkMA]](http://ompldr.org/vNzRkMA)
As you can see only walls cast shadows, boxes can't.
About speed. Lighting calculation done by CPU only. I have 3 GHz CPU and can't test that, but I think my improvement will not slow down the game. Function "isoccluded" very fast because it calls every frame many times. Light calculation happens only once - when map loads (or you edit light params).
Also you must know, that it is only "emulation" of shadows due to limitations of game engine. My code will not generate object shadows, it's possible only in Cube 2 engine. These shadows are "2D", so it is shadows only for walls, ignoring boxes or windows.
As you can see only walls cast shadows, boxes can't.