This is more of a design ramble than a technical issue that I have today. I was hoping to take the approach of having multiple point lights in my game levels, but just use a single shadow caster, but as you can see from the screenshot, this creates some weird situations where a shadow can be cast directly onto a light source which creates a really incorrect result.
As I see it I have three main options here.
- Live with unrealistic lighting. It isn't that important that a dungeon-crawler presents a realistically lit scene.
- Continue to experiment with multiple shadow casters and try to overcome the problems I had. If I use 512x512x512 texture cubes, I seem to be able to render up to about five or six shadow cubes per frame without sacrificing frame rate on my mid-range hardware, so this is technically possible.
- A new approach of maybe fading shadows out if they are falling on pixels that have been lit by another light source. I haven't really thought this through but might be another option.
In the meantime, work has me pretty busy so will just keep a thread running at the back of my brain on this and see if I get any sudden inspiration.
I'm really hoping that whatever solution I come up with doesn't mean I have to apply a lot of restrictions to level design to accomodate. Will be a real pain if the only way I can get acceptable results is to apply a set of very rigid rules to how the level layouts work in terms of where lights and shadow casters are allowed. Obviously I can't expect "just anything" to work properly, but be very nice to be fairly free to design levels without having to worry too much about this.
Thanks for stopping by and please do contribute any thoughts you have on the subject.
[EDIT] Woo hoo
Colour me pretty damn happy with that :)
Loads to do to improve but that will be next post.
[EDIT again]
And one more screenshot for tonight... :)
We are maintaining a steady 60 fps at 1280x768 on my mid-range laptop so seems three lights is going to work fine. Four starts to push it unless I drop the cubemaps down to 256x256x256 at which point the shadow edges start looking a bit ropey, but I reckon I can live with three lights active at a time in a dungeon crawler.
The main thing is that lights can be mobile, as I can see a lot of good gameplay coming from the player having to carry a light source around dark areas.
>> I cannot be the only person to want to use a single shadow caster in an environment with multiple point lights
while multiple lights and a single shadow caster might be convenient, its also physically impossible in the real world. So I would not expect there to be much research on a technique that does not produce correct results in the first place. Especially something that can be as complex as shadows. All that work for something that's incorrect?
I'd do what you can that is believable, and forget about the rest. So maybe multiple lights and no shadows whatssoever.
The other option is to fake it by using a single shadow caster, then designing levels with a "main light" that casts shadows, and "other lights" which can only be placed where the main light does not shine on them.