Lighting Dynamics Demo

Showcase your libraries, tools and other projects that help your fellow love users.
scutheotaku
Party member
Posts: 235
Joined: Sat Dec 15, 2012 6:54 am

Re: Lighting Dynamics Demo

Post by scutheotaku »

raidho36 wrote:Yeah, it's pretty good. Once I did almost exactly the same thing with GameMaker, but due to it's exceptional performance my demo was nowhere close to what's seen on that video regardless vast efforts to keep it fastest possible. Oh well. I think I'd rewrote it for löve once I get used to it. Was considering switching long ago, but baby duckling syndrome is a powerful thing. :P

I assume it can be done easily with löve, since it only requires offscreen buffers and blending modes (and maybe graphical primitives):

0) render your scene lit white
1) for each light source perform the following
2) set target shadow render buffer, clear to black
3) render light source texture onto it
4) then for each shadow casting object
5) render shadow, particular algorighm depends on particular object type, obviously
6) after that, merge (with addition blend mode) shadow render buffer to shadow accumulator buffer
7) after all light sources done, place composed shadow buffer onto scene with multiply blend mode.

And make sure you cull what's not visible, this is kinda tricky task. I'm not entirely sure how do I acheive this effect only using stencil buffers (probably just render-your-shadows-to-stencil -> render your light -> repeat over), so I just post how I did it.
Ah, brought back memories of my Game Maker days a few years back...reminds me of GearGOD's famous lighting systems for GM ( http://gmc.yoyogames.com/?showtopic=97157&hl= | http://gmc.yoyogames.com/?showtopic=135115 ). Nice work!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests