Page 1 of 5
Shädows (A light engine)
Posted: Sun Jul 10, 2016 6:25 pm
by Starkkz
Hello, I'm here to share my dynamic shadows and lights library. This is pretty comparable to Light vs Shadows by PriorBlue, since most of the code was inspired from it. Except that this one has major optimizations in it's code.
Repository
https://github.com/Starkkz/shadows
Wiki
https://github.com/Starkkz/shadows/wiki
Issues
https://github.com/Starkkz/shadows/issues
I'm open to receive feedback and code contributions to the repository.
Re: Shädows (A light engine)
Posted: Sun Jul 10, 2016 7:02 pm
by airstruck
Can you post a small demo? I'd like to try it out
Re: Shädows (A light engine)
Posted: Sun Jul 10, 2016 7:26 pm
by Starkkz
Here you go.
https://github.com/Starkkz/shadows/wiki ... onstration
https://github.com/Starkkz/shadows/wiki ... onstration
It's supposed to do the same, the first example uses a love.physics world and the second one are plain Lua functions from the library.
Re: Shädows (A light engine)
Posted: Mon Jul 11, 2016 8:34 am
by asmageddon
Hey, I played with it a bit, definitively looks nice - though I'm not a fan of the filters you include by default, tbh.
I tried playing around with the, ahem, bodycount, and on my moderately powerful PC, with 40 static + 40 dynamic bodies, the FPS dips below 60 FPS at around 20-22 lights - not awful, but not that great. The first observation that comes to mind is that you recalc lights when the scene changes, regardless of whether the changes occur within their radius, it'd be nice to see that optimized out.
Another thing I can't help but note - are the mild halos around shadows if I turn the filters off - what are those, and where do they come from?
Also, a feature I'd like to request - "infinite" length shadows, e.g. not ending a certain distance after an object. And, while it's not crucial, it'd be nice to have (optional, of course) soft shadows.
Either way, thanks for the great lib
Re: Shädows (A light engine)
Posted: Mon Jul 11, 2016 5:35 pm
by Starkkz
I applied some optimization filters, could you try it again?
What do you mean by mild halos, could you show me some screenshots?
I could implement a 'infinite' length canvas for multi-use inside the light engine, although it may be a bit complex.
I'm unable to make soft shadows, I already tried and got several failures.
Edit: I've read some articles about how you calculate the shadow fins, but there's a problem with that, how do you actually calculate the shadow fins of a circle or a shadow with a specific height (like the ones from the demo)?
This is how it would actually look.
Re: Shädows (A light engine)
Posted: Tue Jul 12, 2016 2:25 am
by Starkkz
I seem to have achieved softer shadows but my shader script isn't somewhat amazing so I'm probably going to need a little bit of contributions in there.
Re: Shädows (A light engine)
Posted: Tue Jul 12, 2016 8:47 am
by asmageddon
Halo:
https://love2d.org/imgmirrur/BbUE2MS.png
Btw, you should probably do soft shadows not with shaders, but with polygons, texturing the penumbra with a gradient triangle, at least that's how I've seen it done.
Re: Shädows (A light engine)
Posted: Tue Jul 12, 2016 1:01 pm
by Starkkz
That's the bloom effect. About the polygons, maybe I could use a textured Mesh.
Re: Shädows (A light engine)
Posted: Tue Jul 12, 2016 7:31 pm
by Starkkz
Alright, after trying to use polygons to solve this out desperately I ended up realizing that the shadow's image was being eaten by the light's shadow'd area. So in order to get a corrected soft shadow I had to use a multiply blending mode, basically I changed a little piece of the code and I think it looks much better.
And this is with all the shaders deactivated, except for the penumbra shader.
Re: Shädows (A light engine)
Posted: Wed Jul 13, 2016 7:52 am
by asmageddon
I think it looks good, though the lights look a bit odd when they add up to that bright blotch. I guess that's more of a problem for HDR than anything else, though.