Lighting in 2D

BlitzMax Forums/BlitzMax Programming/Lighting in 2D

FBEpyon(Posted 2010) [#1]
Hello,

I'm working on a game engine and I was wanting to know if there was a way to do lighting where only parts of the sprites are color, with out having to use SetBlend to add and use a large sprite...

If I need to make my own 2d engine I will is it requires multiple vertex per sprite (image) to and assign vertex colors.


FBEpyon(Posted 2010) [#2]
NOTHING!! COME ON!! LOL


Dreamora(Posted 2010) [#3]
There is none that simple it is.

Either you use pixel shaders or vertex colors

You could do an overlay alpha draw but thats troublesome cause everything else behind the light geometry will be lit too (none the less thats what I do normally)


Arowx(Posted 2010) [#4]
Have you seen Rigz particle FX engine he's got lightining working in that...

http://www.rigzsoft.co.uk/index.php?option=com_content&view=article&id=1&Itemid=16

Third video down shows a nice lightining style effect and he also produced a cool lighting effect for the cover of blitzmax coder .02 (see sig)


FBEpyon(Posted 2010) [#5]
Thats a nice system, but not what I'm looking for.. I'm looking for select lighting..

Exp: Player is half on the light and is only half lit, I have full tile lighting, but I want to only light half a tile some times.


Arowx(Posted 2010) [#6]
But you don't want to use setblend lightblend with an alpha mask, in that case you would probably either have to draw another sprite with that lighting or get down and change the values of the tiles/sprites pixels.


ImaginaryHuman(Posted 2010) [#7]
Hmm.. draw all of your lights first to the backbuffer, then draw everything else in SHADEBLEND?


FBEpyon(Posted 2010) [#8]
hmm... that might work.. I will work on this..


Zeke(Posted 2010) [#9]
http://www.blitzmax.com/Community/posts.php?topic=49403#550016 this??


FBEpyon(Posted 2010) [#10]
That would be it, THANKS!!!


Zeke(Posted 2010) [#11]
cool. thats what im using. and that works just fine.


Gabriel(Posted 2010) [#12]
I wonder what happened to TonyG. Haven't seen him in ages. (Sorry, I know that's terribly off topic but since the OP has an answer... )


Zeke(Posted 2010) [#13]
maybe he sold his account to someone.. who knows.