Page 2 of 2

Re: Light, a shadow system for LÖVE

Posted: Fri Feb 19, 2016 8:30 pm
by Ranguna259
alberto_lara wrote:This is actually pretty cool, terrific work!
Thanks :D
NightKawata wrote:my favorite part is that the screenshot looks like a 1990s game ad
It does indeed, the next version will have an even more amaizing screenshot.
Foogles wrote:This looks fantastic! I am making a simple arcade game without any fancy graphics. Adding some lighting may give it a less flat look.

If I use this library in my projects, is there something I should be doing to credit you for your work?
Cool idea, you could add the name of the lib followed by my name on your credits.
AC Vis wrote:I love how simple this is to use. It would be great if it worked with a camera system...to my knowledge, which is limited, I can't recall a lighting/shadow system for Love that does work with cameras. Which means there is no workaround?
There are workarounds, but they are really difficult to code and they use up a lot of memory. I've already designed two ways to make this lib compatible with camera libs, I'm going to start working on them once the next update hits.
The easiest solution is to draw your whole map into a canvas, feed it's width and height into light, draw the shadows and use the shadows canvas as input to your cam lib, this, however, uses a lot of memory since most maps are big and so the resulting canvas would also be big.

The next update will introduce shadows on top of the scene.

Re: Light, a shadow system for LÖVE

Posted: Sat Feb 27, 2016 12:54 pm
by drikdrok
Ranguna259 wrote:
drikdrok wrote:Thank you very much! I will look for a solution too :)!
You are welcome, if you find anything post here or PM me :)
I got it to work after a little break, it was only because i forgot to "love.graphics.clear()" :)

Re: Light, a shadow system for LÖVE

Posted: Sat Feb 27, 2016 12:57 pm
by drikdrok
Another question:
I remember "Light Vs Shadows" made things far away from light darker. Is it possible with this?

Re: Light, a shadow system for LÖVE

Posted: Sat Feb 27, 2016 1:33 pm
by Ranguna259
drikdrok wrote:I got it to work after a little break, it was only because i forgot to "love.graphics.clear()" :)
Do lights that are off the screen work too ? Are there any glitches, for example, lights appearing and disappearing ?
drikdrok wrote:Another question:
I remember "Light Vs Shadows" made things far away from light darker. Is it possible with this?
That's what I'm currently trying to do and I'm almost done.

Re: Light, a shadow system for LÖVE

Posted: Fri Mar 11, 2016 5:46 pm
by drikdrok
Ranguna259 wrote:
drikdrok wrote:I got it to work after a little break, it was only because i forgot to "love.graphics.clear()" :)
Do lights that are off the screen work too ? Are there any glitches, for example, lights appearing and disappearing ?

drikdrok wrote:Another question:
I remember "Light Vs Shadows" made things far away from light darker. Is it possible with this?
That's what I'm currently trying to do and I'm almost done.
1) No, I have not found any glitches.
2) Cool! I am very excited :D!

Re: Light, a shadow system for LÖVE

Posted: Mon Apr 11, 2016 11:14 pm
by AntonioModer
Cool, thanks.
I too, have 2d shadows project: viewtopic.php?f=5&t=80751

Re: Light, a shadow system for LÖVE

Posted: Mon Jul 11, 2016 11:04 am
by asmageddon
Hey, I have an optimization suggestion: While it'd increase the amount of drawcalls, you could probably optimize the raycasting tremendously with some mipmapping, binary search, and clever sampling, let me explain:

Say you have a 360x512 polar bitmap of the scene, first you generate 360x128, 360x32, 360x8, 360x2 versions of the bitmap, sampling 2 points between pixels at each step.

Second(or ideally as a part of the first step), you copy all the mipmaps into a single image, to allow the raycasting shader to access all of them.

Third, you start raycasting by sampling pixels of the lowest resolution version, switching to the higher resolution versions if the pixel's value isn't perfect 0.0 or 1.0, sampling between pixels at each step, only doing a pixel-perfect check as the last step.

I believe that this would speed the algorithm up a lot, especially for sparse scenes, or high radius lights, and allow you to do some supersampling to smooth out the slight visual artifacts and introduce AA, by reducing the amount of samples and iteration the shader has to do.

Either way, great work :)