Löve "Light vs. Shadow" Engine v2

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
nfey
Citizen
Posts: 63
Joined: Tue Feb 18, 2014 9:50 am
Location: Romania

Re: Löve "Light vs. Shadow" Engine v2

Post by nfey » Thu Dec 04, 2014 1:58 pm

@drunken_thor : speaking of optimizations and speed, while nosing around in the code, I think I noticed that the library currently draws all shadows, for all bodies, for each light. From what I can see, it doesn't take into account whether there is something between a body and a light, or whether the body is too far away from the light for it's shadow to be drawn. Is this correct? Are you looking at optimizing this?
I can't offer coding help right now (I was thinking of optimizing it myself, but I'm working on other areas of my project atm), but I can try testing your solutions.

Also, the animation support sounds really good :)

giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

Re: Löve "Light vs. Shadow" Engine v2

Post by giann » Fri Dec 05, 2014 3:31 pm

Awesome work ! Thanks a lot !

There seems to be a problem with multiple lights.

I have 2 lights: the first is ok, the second works ok for the shadows but the bodies are not lighted.
Attachments
2lights.png
2 lights issue
2lights.png (35.6 KiB) Viewed 3044 times

User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor » Fri Dec 05, 2014 9:11 pm

nfey wrote: @drunken_thor : speaking of optimizations and speed, while nosing around in the code, I think I noticed that the library currently draws all shadows, for all bodies, for each light. From what I can see, it doesn't take into account whether there is something between a body and a light, or whether the body is too far away from the light for it's shadow to be drawn. Is this correct? Are you looking at optimizing this?
I can't offer coding help right now (I was thinking of optimizing it myself, but I'm working on other areas of my project atm), but I can try testing your solutions.

Also, the animation support sounds really good :)
I optimized this now so I make sure that the object is both on screen and within light range. Optimizing it future (i.e. seeing if it is already in shadow) would probably not optimize it much further because the checking would be costly.

Animations are now supported, check them out in the new release demo I just posted.
giann wrote: Awesome work ! Thanks a lot !

There seems to be a problem with multiple lights.

I have 2 lights: the first is ok, the second works ok for the shadows but the bodies are not lighted.
Please try the new code that I just released. And report back to me because I redid how shine and shadow are calculated. Sorry about making you rewrite.
Light_world.lua for all your lighting needs
Github
twitter

User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor » Fri Dec 05, 2014 10:36 pm

Jeeper wrote:Just a PSA to anyone who intends to use this library and is using STI, the v2 of Shadow vs light changed the way it uses canvases and does not like STI for that reason. After struggling for a long time with trying to implement this updated version to my current project, I spoke to "drunken_thor" (Who manages the library) and he confirmed that it is not compatible with STI.

The old Shadow vs Light does not have this issue however, so If you intend to use STI then I would recommend using it. A few major improvements made in this version are missing though, but I have managed to fix most of them (Such as scaling and translation, removal of shadow and light bodies etc). So if you intend to do like me and use the older version, feel free to ask for help in case you run into any issues.
Just a update on this, I have been playing around on getting these two libraries working together and have figured out what is the problem, please follow this bug that I have logged with the creator of STI https://github.com/karai17/Simple-Tiled ... /issues/65
Light_world.lua for all your lighting needs
Github
twitter

giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

Re: Löve "Light vs. Shadow" Engine v2

Post by giann » Fri Dec 05, 2014 10:37 pm

The issue with multiples ligths is fixed. But now the shadow aren't blurred. I tried :setShadowBlur with no success.
Attachments
Screen Shot 2014-12-05 at 23.36.33.png
Screen Shot 2014-12-05 at 23.36.33.png (46.45 KiB) Viewed 3021 times

User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor » Fri Dec 05, 2014 10:42 pm

giann wrote:The issue with multiples ligths is fixed. But now the shadow aren't blurred. I tried :setShadowBlur with no success.
Ah yes I see you are right, the whole shadow drawing process was rewritten, I was bound to miss something. I will let you know when I get that back working.

Cool looking game you got there! Have you noticed any better performance?
Light_world.lua for all your lighting needs
Github
twitter

User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor » Fri Dec 05, 2014 10:51 pm

giann wrote:The issue with multiples ligths is fixed. But now the shadow aren't blurred. I tried :setShadowBlur with no success.
Okay I push a change that will fix it though when the number gets higher it leaves objects with weird halos I doubt your will see it with normal values but I will try and mitigate it anyways.
Light_world.lua for all your lighting needs
Github
twitter

giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

Re: Löve "Light vs. Shadow" Engine v2

Post by giann » Fri Dec 05, 2014 10:52 pm

Not really since there is nothing much. I'll get a better idea when i'll add more lights. With the old version of light vs shadow, fps was dropping quickly when there was more than 3-5 lights.

I switched back body:drawImageShadow to your previous version, I prefer the shorter shadows. Or is there an option I can use ?

giann
Prole
Posts: 42
Joined: Fri Jun 28, 2013 11:38 am

Re: Löve "Light vs. Shadow" Engine v2

Post by giann » Fri Dec 05, 2014 10:54 pm

Blur is back ! Thks ;)

User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor » Sat Dec 06, 2014 3:51 am

If you increase the z position on your light you will find that the shadows become more finite however image shadows are a lot better for things like characters.
Light_world.lua for all your lighting needs
Github
twitter

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests