Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Light and Shadow Musing - Call for opinions/experience please

Light and Shadow Musing - Call for opinions/experience please

Aardvajk
Aardvajk
Journal of Aardvajk · · 3 min read
3,604 9

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.
    I'm interested in canvassing for people's experience with this issue. I cannot seem to find the correct terms to Google to find other people's thoughts on this. Everything I look up is taking me to techniques for doing multiple shadow casting. I cannot be the only person to want to use a single shadow caster in an environment with multiple point lights, so if anyone wants to chip in with their experience and what they tried or ended up doing, I'd be fascinated to hear.

    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.

Discussion

Loading comments...