Page 6 of 12

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Thu Apr 10, 2014 4:28 pm
by SNK1337
WetDesertRock wrote:If you set the light worlds translation by the same value you set loves translation, and it messes up, then its a bug I think. But you should set both values to the same.
I put this at the start of my love.draw() just to test:

Code: Select all

love.graphics.translate(100, 100)
lightWorld.setTranslation(getLightTranslation(100, 100, 1))
Oh, and this is the code I used in getLightTranslation, basically just some modified variables:

Code: Select all

function getLightTranslation(x, y, scale)
    local tx,ty = width/(2*scale), height/(2*scale)
    tx = tx-x
    ty = ty-y
    return -tx,-ty
end
And this is the result: http://puu.sh/83p9e.png
What am I doing wrong? Again, there's a picture of what it should look like in my earlier post above.

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Thu Apr 10, 2014 4:30 pm
by WetDesertRock
Whats wrong with:

Code: Select all

love.graphics.translate(100, 100)
lightWorld.setTranslation(100,100)
Shouldn't that work?

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Thu Apr 10, 2014 4:32 pm
by SNK1337
WetDesertRock wrote:Whats wrong with:

Code: Select all

love.graphics.translate(100, 100)
lightWorld.setTranslation(100,100)
Shouldn't that work?
Nope, that definitely doesn't work at all http://puu.sh/83psb.jpg

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Thu Apr 10, 2014 10:47 pm
by PriorBlue
SNK1337 wrote:How exactly is translation used with this? If I use the lightWorld.setTranslation() before drawing everything, I get this: http://puu.sh/82uxo.jpg while it's supposed to look like this: http://puu.sh/82uyY.jpg

Do I also have to use love.graphics.translate() at some point? Or are there any other functions I need to get it working properly?
can you post or send me a little code example with your translation functions for testing. I personally don't use camera translations in my projects, because it cause many problems :), so maybe there is a tiny bug in the engine.

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Fri Apr 11, 2014 8:04 am
by SNK1337
PriorBlue wrote:
SNK1337 wrote:How exactly is translation used with this? If I use the lightWorld.setTranslation() before drawing everything, I get this: http://puu.sh/82uxo.jpg while it's supposed to look like this: http://puu.sh/82uyY.jpg

Do I also have to use love.graphics.translate() at some point? Or are there any other functions I need to get it working properly?
can you post or send me a little code example with your translation functions for testing. I personally don't use camera translations in my projects, because it cause many problems :), so maybe there is a tiny bug in the engine.
I just created a little example .love that should let you translate by (10, 10) by holding k. Not really a camera, but I suppose it should be enough for demonstration purposes.

I have the feeling I'm just misunderstanding something and doing it wrong, so please tell me if there's some mistake I'm making. I also tried the getLightTranslation function above by the way, and got similar results, which is why I didn't include it.

My actual camera does pretty much the same thing as this: push, translate, draw stuff, pop. I just felt it'd be easier to make something simpler here for testing.

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Fri Apr 11, 2014 11:34 am
by ArchAngel075
Is there any way to specify a larger light "shape"?

For instance, a space-ship themed game with lasers, the lasers are continuous rather than a short beams.
Each laser is a light source all over its "body", almost like a long rectangular light source.

I can achieve the effect using many sources in increments but that can be stressful in the long run and can create odd shadows...

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Tue Apr 15, 2014 12:20 pm
by giann
Great work ! I can't thank you enough for this !

My game is a top-down point of view.
So shadowType image is not quite what I want to cast shadows for my sprites.
I'm trying to use polygon shadowType instead but I'm still getting a rectangle shadow.

Here is the code:

Code: Select all

    vehicle = love.graphics.newImage('data/img/ships/explorer.png')
    vehicleGlow = love.graphics.newImage('data/img/ships/explorer-glow.png')
    vehicleImage = game.light.newImage(vehicle, 200, 130)
    vehicleImage.setGlowMap(vehicleGlow)
    vehicleImage.setShadowType('polygon', 0, vehicle:getHeight()/2, vehicle:getWidth(), 0, vehicle:getWidth(), vehicle:getHeight());
Any idea why ?

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Tue Apr 22, 2014 1:16 pm
by Jeeper
Anyone know how to make a shadow based on an image(Like this http://onepixelahead.de/love2d_polyshadow18.png)? The documentation is not super clear on that yet (understandable as this is still quite early on).

Also, would this work on something animated?

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Wed Apr 23, 2014 7:19 am
by giann
You set the shadow type to image like that:

Code: Select all

lightImage.setShadowType('image')

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Wed Apr 23, 2014 8:44 am
by Jeeper
giann wrote:You set the shadow type to image like that:

Code: Select all

lightImage.setShadowType('image')
Yeah, but if you have a transparent image with like a circle or triangle, then the shadow is still a square. It just takes the dimensions of the image without accomplishing the effect that I linked to.