I am starting a game project which will allow characters to hide in dark areas. Hiding in a dark corner should make it harder for other characters to see you.
What I need is a way to calculate how the lighting conditions are where the character is located.
The ideal would be to have a
double getLightFactor(GameCharacter observer, GameCharacter target)
since I suppose there could be lighting conditions where light falls so that different sides of the target is hit by different amounts of lights. But I would gladly settle for
double getLightFactor(GameCharacter target)
to get the light for a specific character regardless of where you are watching from or even
double getLightFactor(int x, int z)
to just get the light at a specific map point in the terrain.
The method need to take into account that lighting conditions may change during gameplay, but since it is turn based some heavy calculations could be allowed. I intend to make it possible to use flashlights so they need to be taken into account as well (but they could be modeled and handled separately).
I will be using Ogre3d to handle my scene, but I will happily accept generic solutions or even solutions for other engines (my choice of engine is not carved in stone).
Ideas, papers or really anything relevant is very welcome!