Hi, im trying to learn and apply 2d lighting for my game. There are libraries available for love but those are mainly for top down view, what im aiming is for 2D. Can anyone guide me? Will i be dealing with canvas with blend modes, or shaders?
also, what about sprite illuminator? im pretty sure that software is useful, but have anyone tried using it with love?
Thanks
Help with 2D lighting
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Help with 2D lighting
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- zorg
- Party member
- Posts: 3441
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Help with 2D lighting
Top-Down is also a 2D view, are you thinking about Side-Scrollers perhaps? (Or maybe isometric, those are indeed harder to shadow/light correctly)
I'm pretty sure both canvases, blendmodes and shaders are needed to get a good effect, and i'm suspecting that existing libraries (showcasing top-down demos) could work with side-scrollers as well.
Haven't used SpriteIlluminator myself, but with some simple shaders, it could be used, as well as any of the other 2 sprite lighting editors i know (though those aren't free):
https://www.codeandweb.com/spriteilluminator
http://www.2deegameart.com/p/sprite-dlight.html
http://www.spritelamp.com/
I'm pretty sure both canvases, blendmodes and shaders are needed to get a good effect, and i'm suspecting that existing libraries (showcasing top-down demos) could work with side-scrollers as well.
Haven't used SpriteIlluminator myself, but with some simple shaders, it could be used, as well as any of the other 2 sprite lighting editors i know (though those aren't free):
https://www.codeandweb.com/spriteilluminator
http://www.2deegameart.com/p/sprite-dlight.html
http://www.spritelamp.com/
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Help with 2D lighting
Yes, im talking about sidescroller, sorry i didnt specify.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Help with 2D lighting
As zorg was mentioning. The "top down lighting" can work with sidescrollers too.
What exactly are you missing?
Or to reword that question. What's the difference between top down and sidescroller lighting?
Knowing that makes helping a lot easier
What exactly are you missing?
Or to reword that question. What's the difference between top down and sidescroller lighting?
Knowing that makes helping a lot easier
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Help with 2D lighting
I cant imagine how that would look :/ looking at the demo picture of the other libraries, i just fail to realize how that would look. For example, in the demo pics, there is shadow cast when the rays are blocked right? but how that would be in platformer? the light source is indeed in top, but not to cast shadow as in no visibility? Sorry i cant explain it well :/ thanks for helping btw
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Help with 2D lighting
It kind of look like this:
Note: that is a sample pic of Sprite Lamp
Note: that is a sample pic of Sprite Lamp
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
-
- Party member
- Posts: 134
- Joined: Tue Mar 29, 2011 11:05 pm
Re: Help with 2D lighting
Without any technical information I can only say that a lighting system that advanced (in the zombie image) would require separate normals maps (bump maps) that are pre computed, with the possible addition of depth maps and ambient occlusions maps as well.
These can be created with various software, some of them can work with only an input image and can create the maps for you.
For you then the original image plus the maps can be used real time (most likely in a pixel shader) that also takes in the lighting systems of the level to produce the final image drawn to screen
So all of this is pretty advanced and complicated, but if you want to have a look I believe there is a guy who made a kick starter project for creating these normal maps: http://www.2deegameart.com/p/sprite-dlight.html
There was a thread here: https://love2d.org/forums/viewtopic.php?t=79177
In that thread someone was working on a light vs. shadow library implemenation with the bump maps, however I have no other info: A lot of people will abandon this kind of system because they are using spritesheet animations, which means you will create these bumpmaps for every frame of every animation of every character and object for your entire game.
You could check out this link: https://github.com/tanema/light_world.lua
for some love code with several lighting examples selectable from a menu, might help you out.
Then the inevitable will hit you, you now need detailed and realist shadows to match the lighting; which becomes another problem to solve.
In my own game I went for a simple lighting system with a simple 'fake shadow' that I draw underneath. I play with colours to make some magic and I get something like this (time of day is sunset with lighting from the nearby fires): Not as fancy but there you are.
These can be created with various software, some of them can work with only an input image and can create the maps for you.
For you then the original image plus the maps can be used real time (most likely in a pixel shader) that also takes in the lighting systems of the level to produce the final image drawn to screen
So all of this is pretty advanced and complicated, but if you want to have a look I believe there is a guy who made a kick starter project for creating these normal maps: http://www.2deegameart.com/p/sprite-dlight.html
There was a thread here: https://love2d.org/forums/viewtopic.php?t=79177
In that thread someone was working on a light vs. shadow library implemenation with the bump maps, however I have no other info: A lot of people will abandon this kind of system because they are using spritesheet animations, which means you will create these bumpmaps for every frame of every animation of every character and object for your entire game.
You could check out this link: https://github.com/tanema/light_world.lua
for some love code with several lighting examples selectable from a menu, might help you out.
Then the inevitable will hit you, you now need detailed and realist shadows to match the lighting; which becomes another problem to solve.
In my own game I went for a simple lighting system with a simple 'fake shadow' that I draw underneath. I play with colours to make some magic and I get something like this (time of day is sunset with lighting from the nearby fires): Not as fancy but there you are.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Help with 2D lighting
Awesome! thanks for the input.
Currently i cant afford sprite dlamp, I might just use spriteulliminator.
Another thing is, i dont have any idea on how to apply those normal maps thingy. Will i draw them as well? how?
I would really be grateful if you give me the general workflow or the procedure on how to apply such.
BTW, is that your game? I like the style
Currently i cant afford sprite dlamp, I might just use spriteulliminator.
Another thing is, i dont have any idea on how to apply those normal maps thingy. Will i draw them as well? how?
I would really be grateful if you give me the general workflow or the procedure on how to apply such.
BTW, is that your game? I like the style
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Help with 2D lighting
Lighting is done via a shader on the graphics card. So the normal map needs to be used there as well. Since it's not changing the color but just defining additional information to have the light look more realistic.
An introduction to shaders and lighting I liked quite a bit is by catlike coding.
It's for unity and 3D rendering. But the techniques are essentially the same. 2D is just a bit easier, though also has significantly less tutorials.
Be warned. This is a quite advanced topic which requires a bunch of uni level math.
An introduction to shaders and lighting I liked quite a bit is by catlike coding.
It's for unity and 3D rendering. But the techniques are essentially the same. 2D is just a bit easier, though also has significantly less tutorials.
Be warned. This is a quite advanced topic which requires a bunch of uni level math.
- yetneverdone
- Party member
- Posts: 446
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Help with 2D lighting
Thanks, is there another way instead of using shader? My laptop cant handle that much shader :/erasio wrote: ↑Fri Jan 19, 2018 8:44 am Lighting is done via a shader on the graphics card. So the normal map needs to be used there as well. Since it's not changing the color but just defining additional information to have the light look more realistic.
An introduction to shaders and lighting I liked quite a bit is by catlike coding.
It's for unity and 3D rendering. But the techniques are essentially the same. 2D is just a bit easier, though also has significantly less tutorials.
Be warned. This is a quite advanced topic which requires a bunch of uni level math.
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Who is online
Users browsing this forum: Ahrefs [Bot] and 21 guests