A while back I posted a demo of a single-light shadow casting system I was experimenting with using the new transform support. Out of that came the idea of combining it with a static lighting system, and I finally found time to hack together a proof of concept:
The blue circles are static lights, and the yellow circle is the one dynamic light.
I've still got a lot of work to do on it (ugh, just noticed a static lighting error on the walls..), but I think it's showing some promise :)
You can try it out below, you really gotta walk around to get the full effect:
Torchbearer_dmb_20140520.zip (404kb)
(the included DLL is for generating the static lighting. It's a slightly updated* version of the one from my Static Lighting Generator 2 demo)
I'll release the code as a demo once I get the last couple of features in and kinks worked out.
*looking at code you haven't touched in three years is always an interesting endeavor!
ID:1578429
May 19 2014, 9:04 pm
|
|
Yeah i was expecting some creepy ghosts hiding around the corners.
Nice work, this looks great :) |
In response to Crazah
|
|
Crazah wrote:
Very impressive work. Have you set this up to scale with multiplayer? Currently only a single dynamic light can be visible to a player at one time, as I haven't been able to come up with a way to reconcile overlapping light/shadows from two different dynamic lights. I'm planning to use this system for games with a single "group controlled" dynamic light source, but technically it could be updated to give each player their own personal light source (or line-of-sight). CPU usage averages between 7 and 9 percent on my 2.9GHz processor, so doing it per-player may not be practical without significant optimization. I'm hoping the single-light version will run smoothly over the internet for ~4 players on the same continent with a decent server*, but the tests I've done so far haven't exactly inspired confidence. That said, I've still got a lot of potential CPU and network optimizations I can make, so I'm still hopeful. *so long as the planets are aligned and no one is using a science oven |
Using the cookie method, unfortunately there's no way to reconcile overlapping lighting period until we have some means of alpha-masking via blend modes.
|
In response to Ter13
|
|
Yea, I saw that feature request. It would be pretty awesome. It would probably require some kind of intermediary render target or at least a stencil buffer to implement, though.
Right now I'm using "cookie cutter" white gradients for my static lights, and I can blend several of them together alright using ADD (and then I have my actual turfs on top as MULTIPLY). My issue is that my dynamic lights use something like "silhouette extrusion" to draw black shadows, instead of the white light, and I can't really cancel-out the shadows where a second dynamic light shines. If your masking idea could be implemented, then maybe I could reverse my system so it was drawing the white gradient where the shadows aren't, and then use the same blending I am now for the static lights. But it would require a separate mask for each dynamic light (dynamic lighting always seems to require multiple passes!) |
=]