Page 1 of 1

2D Lighting

Posted: Sun Aug 11, 2013 5:52 am
by HazardBlu
Well I want to understand how 2D lighting works in game programming. I've been searching around the web and I've seen tutorials on how to implement 2D Lighting in your game, but I need an explanation on how it works. I have also come across the word "shader", so I'm guessing that's pretty important. Can someone refer me to a good article explaining the general concept of 2D lighting. Or just explain it on the forum. :megagrin:

Re: 2D Lighting

Posted: Sun Aug 11, 2013 6:08 am
by T-Bone
Well, it really depends on what you want to do. It would really help if you would clarify that, because picking the right tool for the right job is important.

I'd say most 2D games simply draw their sprites with shadows and lighting on them and just leave it like that. For more fancy effects, shaders can be used. They're simple programs that are executed while drawing each pixel on screen, allowing you to modify it. They run on the GPU, because the GPU is very good at stuff like that. If that's what you want, go and learn some basic GLSL (they are tons of guides online, just google it) and then check out http://love2d.org/wiki/PixelEffect