Page 4 of 15

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

Posted: Thu Dec 04, 2014 1:58 pm
by nfey
@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 :)

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

Posted: Fri Dec 05, 2014 3:31 pm
by giann
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.

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

Posted: Fri Dec 05, 2014 9:11 pm
by drunken_thor
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.

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

Posted: Fri Dec 05, 2014 10:36 pm
by drunken_thor
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

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

Posted: Fri Dec 05, 2014 10:37 pm
by giann
The issue with multiples ligths is fixed. But now the shadow aren't blurred. I tried :setShadowBlur with no success.

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

Posted: Fri Dec 05, 2014 10:42 pm
by drunken_thor
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?

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

Posted: Fri Dec 05, 2014 10:51 pm
by drunken_thor
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.

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

Posted: Fri Dec 05, 2014 10:52 pm
by giann
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 ?

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

Posted: Fri Dec 05, 2014 10:54 pm
by giann
Blur is back ! Thks ;)

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

Posted: Sat Dec 06, 2014 3:51 am
by drunken_thor
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.