Light, a shadow system for LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Light, a shadow system for LÖVE

Post 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.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Light, a shadow system for LÖVE

Post 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()" :)
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Light, a shadow system for LÖVE

Post by drikdrok »

Another question:
I remember "Light Vs Shadows" made things far away from light darker. Is it possible with this?
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Light, a shadow system for LÖVE

Post 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.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
drikdrok
Prole
Posts: 36
Joined: Sun Mar 15, 2015 9:53 am
Contact:

Re: Light, a shadow system for LÖVE

Post 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!
asmageddon
Prole
Posts: 13
Joined: Mon Apr 09, 2012 1:39 pm

Re: Light, a shadow system for LÖVE

Post 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 :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 1 guest