Page 1 of 1

[demo] Lighting with shadows

PostPosted: Fri May 11, 2007 1:18 pm
by morcior
I had an idea to create a lighting effect with realtime shadows using the draw_from function in the latest version of GE, so I made this little demo. I don't think its that practical for use in games since multiple lights won't blend together (BLEND OPTIONS ON DRAW_FROM PLEASE MAKSLANE!!!!), and draw_from can't scale very fast either.

anyway here it is:

Image

PostPosted: Fri May 11, 2007 2:27 pm
by AnimeTank
Wow, i am impressed! I never new GE had such a function to do that. Well yea, probably. Well anyway, thats terrific. I know that took some time out of your day. Now only if you can incorporate that into a real game, that would be just awesome. Keep up the great work :D

PostPosted: Sat May 12, 2007 3:51 am
by morcior
Thanks, I guess I should explain the effect a bit:

It uses 2 canvases. 1 for the light 'mask' , and one for drawing the shadow.

the light mask is positioned above everything, and it is cleared to black (rgb(0,0,0)) with 0.1 alpha every frame, almost completely opaque.

you then render a png file with an alpha layer (that looks like a light, radial gradients work well!) using draw_from, this bakes the alpha over the existing darkness and you get the light effect over whatever is under the actor.

its then just a case of drawing the shadow based on the lights position relative to the actor and calulating the scale. I just guessed at this code, a much better job could be done I'm sure. Its in bg2->Draw Actor

PostPosted: Sat May 12, 2007 5:39 pm
by scythe
Looks cool.

Scythe

he eh

PostPosted: Sat May 12, 2007 11:53 pm
by kyensoftware
heh heh heh...I replaced the shadow pic with a car, and now it looks demented...Cool!

PostPosted: Sun May 13, 2007 2:23 am
by Joshua Worth
if the draw_from function is fast enough, you could do split-screening :)

PostPosted: Sun May 13, 2007 11:42 pm
by Game A Gogo
draw_from is really fast for me

same

PostPosted: Mon May 14, 2007 10:06 am
by kyensoftware
Same, but I have an ATI Radeon 9200, which has good resizing.
don't you have a Gfx processor from the ATI Radeon series, gogo?

Cool...

PostPosted: Sat Jun 09, 2007 4:58 am
by Bee-Ant
Cool man...I like it!!! :D

Re: same

PostPosted: Sun Jun 10, 2007 12:46 am
by Game A Gogo
kyensoftware wrote:Same, but I have an ATI Radeon 9200, which has good resizing.
don't you have a Gfx processor from the ATI Radeon series, gogo?


wow, never actually seen this, so I guess I will comment right now :3

No, All I have for my GFx possessor is from intel.