Hey everyone.
atm I'm working on a 2D Puzzle Platformer and want to draw a light beam on every object which is able to shine ( and on the player, some kind of sight ).
My first idea maybe was the simplest. a image which is centered on the objects position.
Problem: for the player only it does work with the image, but the image has to be much bigger then the screen because of the camera movement. ( and also the image file is big )
Now I want to let torches shine or laserbeams etc. as well. So the image variante does not work anymore.
Is there a way to use pixeleffects to let specific objects shine?
I've never tried something like this before and also don't know how pixeleffects work .
( is it even possible with pixel effects ? )
thanks.
Light beams - some kind of lighting system?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Light beams - some kind of lighting system?
i don't know if pixeleffect will work for that (i think that yes because IF i understand corectly, pixeleffect is a sort of layer (shader) who add an effect depending of the image drawed and some parameters) but if you choose it, don't forget to send me a graphic card by post with your .love game because i don't have any pixeleffect supportLarsii30 wrote:Is there a way to use pixeleffects to let specific objects shine?
Current work : Isömap
Re: Light beams - some kind of lighting system?
hehe, too bad. I also would prefer a way to do it without pixeleffects ( because I don't know how to use it and didn't got much time to find it out )
I imagine such a lighting system in general isn't as easy.
I've seen something like this in a "game" called "Not a Game" by VRLD but I don't find the thread.
Need some guidence.
Did anyone else something like this before ?
I imagine such a lighting system in general isn't as easy.
I've seen something like this in a "game" called "Not a Game" by VRLD but I don't find the thread.
Need some guidence.
Did anyone else something like this before ?
Re: Light beams - some kind of lighting system?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Light beams - some kind of lighting system?
you could use shaders alright to do this. don't ask me how cause i don't have a flaming clue but this viewtopic.php?f=5&t=11076&hilit=lighting might help.
other than that, if you want specific objects to "shine", maybe you could make an "unlit" and "lit" image for each one. draw the "lit" image over the "unlit" one and update it's alpha depending on how far away the light source is.
For example: let's say you want a floor tile (grass in your case) to "reflect" the light of a torch, you could make two images for the tile. a normal one and a second one with the brightness on the grass turned up. then do a distance check between the grass tile and the torch. depending on the distance, set the alpha value of the "reflect" image. so the closer it is, the higher the alpha value, the brighter the grass looks. this would also mean you could move the light source on the fly and the lighting of your objects would change too. could be kinda cool.
i haven't tried this before, it just came to my head there. but it might give you an ok looking lighting effect without using shaders.
good luck! nice work so far btw
other than that, if you want specific objects to "shine", maybe you could make an "unlit" and "lit" image for each one. draw the "lit" image over the "unlit" one and update it's alpha depending on how far away the light source is.
For example: let's say you want a floor tile (grass in your case) to "reflect" the light of a torch, you could make two images for the tile. a normal one and a second one with the brightness on the grass turned up. then do a distance check between the grass tile and the torch. depending on the distance, set the alpha value of the "reflect" image. so the closer it is, the higher the alpha value, the brighter the grass looks. this would also mean you could move the light source on the fly and the lighting of your objects would change too. could be kinda cool.
i haven't tried this before, it just came to my head there. but it might give you an ok looking lighting effect without using shaders.
good luck! nice work so far btw
Re: Light beams - some kind of lighting system?
thanks felix.
I thing I will try something like this
I thing I will try something like this
Re: Light beams - some kind of lighting system?
As far as the shadow image goes, you could just enlarge that. Might be a choppier gradient, but I don't think it really matters in a pixellated game.
For the "shining" of torches and the such, you could draw a glow effect (like a reverse shadow, see?) OVER the shadow. The glow effect wouldn't show any of the walls or things near the torch, but you can still see the torch's glow and whatnot.
That's the easiest way I can think of doing it.
For the "shining" of torches and the such, you could draw a glow effect (like a reverse shadow, see?) OVER the shadow. The glow effect wouldn't show any of the walls or things near the torch, but you can still see the torch's glow and whatnot.
That's the easiest way I can think of doing it.
Re: Light beams - some kind of lighting system?
Great idea, there are only three little problems.felix24 wrote: idea with distance and alpha value here
First, I can't use canvases anymore :/ ( could get fixed )
Second, my math is terrible Look :
Third , the result does not look exectly how I want it, but maybe this way looks also good enough here is my test file( just loads a map ): I search for some math to do this....
Re: Light beams - some kind of lighting system?
ok so i fixed it up a bit with a quick and dirty solution. it now lights around the two torches and around the mouse cursorLarsii30 wrote:Great idea, there are only three little problems.felix24 wrote: idea with distance and alpha value here
First, I can't use canvases anymore :/ ( could get fixed )
Second, my math is terrible Look :
Third , the result does not look exectly how I want it, but maybe this way looks also good enough
here is my test file( just loads a map ): I search for some math to do this....
i attached the updated love file
- Attachments
-
- LightingTest 2.love
- (9.99 KiB) Downloaded 109 times
Re: Light beams - some kind of lighting system?
I owe you. Thanks. !
Who is online
Users browsing this forum: Google [Bot] and 0 guests