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.
Shädows (A light engine)
Re: Shädows (A light engine)
Can you post a small demo? I'd like to try it out
Re: Shädows (A light engine)
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.
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.
-
- Prole
- Posts: 13
- Joined: Mon Apr 09, 2012 1:39 pm
Re: Shädows (A light engine)
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
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)
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.
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)
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.
-
- Prole
- Posts: 13
- Joined: Mon Apr 09, 2012 1:39 pm
Re: Shädows (A light engine)
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.
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)
That's the bloom effect. About the polygons, maybe I could use a textured Mesh.
Re: Shädows (A light engine)
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.
And this is with all the shaders deactivated, except for the penumbra shader.
-
- Prole
- Posts: 13
- Joined: Mon Apr 09, 2012 1:39 pm
Re: Shädows (A light engine)
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.
Who is online
Users browsing this forum: No registered users and 7 guests