Hey everyone, So I found this http://www.love2d.org/forums/viewtopic.php?f=5&t=77418 topic a while ago and love the light engine but it didn't react well to scaling at all so I rewrote it here! https://github.com/tanema/light_world.lua
Some changes I made:
- rewrote the codebase to be much easier to extend and modify
- scaling works now
- translation works with by passing it into the draw call
- took out all the globals and love namespacing
- made the postshader independant from the project so you can use the postshader on its own but it is also nicely coupled into the light_world so you dont have to worry about canvases if you are using both
- made it easy to drop a shader into the postshaders dir and it will work with provided arguments.
- made all paths relative to the lib directory so that the folder can be placed anywhere.
Some todos I would like to do is:
- take into account rotation and shear on objects and camera.
Version 2 [RELEASE] Added new attachment to show new stuff
- I optimized how normals/shine/shadows are all drawn. They are all now drawn as an overlay instead of needing a background call and a foreground call. This should speed up the library as a whole as well.
- because of the previous point I simplified how the library is called for drawing hopefully making it more simple
- Added animations using anim8. I integrated this into the library because I need to keep track of the normal and spritesheet animations at the same time. (I will be adding documentation for this slowly but there are examples to show it off)
- Added an example of how to use the hump camera and the gamera camera.
Worked with karai17 and got STI support
- added new example to show STI functionality check out the 2.1 love file
Note Also I created this tool for my own use to generate shitty normal maps for spritesheets, also I use it to trim CrazyBump normal maps (get rid of background from spritesheets) just thought you might like to use it as well https://github.com/tanema/myspritenormaltool
Important! just published an update that will now require update to be called on your light world. This optimizes range checking of light bodies. Please see the github page for an example of how to do so. There have been significant speed optimizations though please check them out and tell me how it goes.
Löve "Light vs. Shadow" Engine v2
- drunken_thor
- Citizen
- Posts: 75
- Joined: Wed Oct 01, 2014 12:14 am
- Location: Toronto, Canada
- Contact:
Löve "Light vs. Shadow" Engine v2
- Attachments
-
- light_worldv2.1.love
- STI example now included
- (9.24 MiB) Downloaded 2328 times
-
- light_worldv2.love
- check out the new animations
- (9.19 MiB) Downloaded 755 times
-
- light_world.love
- (1.14 MiB) Downloaded 1111 times
Last edited by drunken_thor on Sun Dec 21, 2014 6:23 pm, edited 7 times in total.
Re: Löve "Light vs. Shadow" Engine v2
Amazing job, well done! I am sure the original author appreciates that his work lives on
Re: Löve "Light vs. Shadow" Engine v2
Awesome! More than awesome!
My library for easy saving Slib! Try this! Now you can encrypt your save!
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
-
- Prole
- Posts: 2
- Joined: Sat Mar 08, 2014 9:18 pm
Re: Löve "Light vs. Shadow" Engine v2
It would also be nice if there was a way so that the top of objects isn't illuminated when the light is near them
- 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
Do you mean it stays dark or that the light doesnt effect it. You can do the latter by using body:setShine(false).Nathan1852 wrote:It would also be nice if there was a way so that the top of objects isn't illuminated when the light is near them
-
- Prole
- Posts: 4
- Joined: Wed Oct 29, 2014 6:37 pm
Re: Löve "Light vs. Shadow" Engine v2
Hello. Pls help with use this library. I create new light source:
But how totaly remove this light source?
Code: Select all
lightWorld = love.light.newWorld()
newlight=lightWorld.newLight(100, 100, 255, 230, 0, 30)
- 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
right now there is no way to remove a light but I can add that pretty easily, I will get back to you when its done.
- 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
I added a `remove()` method to the light world to remove any object that is already in the light world please see the wiki: https://github.com/tanema/light_world.l ... ebodylightNeonLight_Child wrote:Hello. Pls help with use this library. I create new light source:But how totaly remove this light source?Code: Select all
lightWorld = love.light.newWorld() newlight=lightWorld.newLight(100, 100, 255, 230, 0, 30)
Re: Löve "Light vs. Shadow" Engine v2
Thank you for doing this! I've been wanting to create a game with that engine for a while now, and this will probably make the process much more painless.
I'm having an issue however: Am I doing something wrong, or is the translation of the light source somehow buggy? For example, when setting it to exactly (500, 500) and moving the camera in the example "short.lua", the shadows act as if the light was stationary (meaning they stay the same when translating, which is what they're supposed to do), but the glow of the light moves with the camera. This also results into some weird bugs with the default "short.lua", since the glow and the shadows start not fitting together when pressing the arrow keys.
I'm having an issue however: Am I doing something wrong, or is the translation of the light source somehow buggy? For example, when setting it to exactly (500, 500) and moving the camera in the example "short.lua", the shadows act as if the light was stationary (meaning they stay the same when translating, which is what they're supposed to do), but the glow of the light moves with the camera. This also results into some weird bugs with the default "short.lua", since the glow and the shadows start not fitting together when pressing the arrow keys.
- 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
I am not sure what you are setting to 500,500. I just tried setting the conf.lua to 500,500 and it worked fine. Do you have the updated code? How are you running the project? can you post some screen shots of bugs? or post the bugs on the github issues?SNK1337 wrote:Thank you for doing this! I've been wanting to create a game with that engine for a while now, and this will probably make the process much more painless.
I'm having an issue however: Am I doing something wrong, or is the translation of the light source somehow buggy? For example, when setting it to exactly (500, 500) and moving the camera in the example "short.lua", the shadows act as if the light was stationary (meaning they stay the same when translating, which is what they're supposed to do), but the glow of the light moves with the camera. This also results into some weird bugs with the default "short.lua", since the glow and the shadows start not fitting together when pressing the arrow keys.
Who is online
Users browsing this forum: No registered users and 0 guests