Page 1 of 1
Applying a textured overlay
Posted: Tue Oct 20, 2015 8:53 pm
by Defender Vex
Hi, i'm new to Love2D and so far i'm enjoying it. I'm wanting to apply a textured overlay onto the game, for example making it look like the game sprites are made of fabric. I know I could just do this when I make the texture but i'm wanting to keep the texture static and making it look like the sprites are moving along it while being textured by it.
Is anyone able to point me into the right direction on how I can achieve this?
- Thanks
Re: Applying a textured overlay
Posted: Tue Oct 20, 2015 9:21 pm
by DeltaF1
Maybe i'm misunderstanding what effect you want, but can't you just draw the texture slightly transparently over the whole screen? If you want the texture to only show through, maybe you should look into [wiki]love.graphics.setStencil[/wiki]?
Re: Applying a textured overlay
Posted: Tue Oct 20, 2015 9:28 pm
by bobbyjones
You can also use a shader to give the look you want.
Re: Applying a textured overlay
Posted: Tue Oct 20, 2015 10:26 pm
by Defender Vex
Yea, I think a stencil will work but i've yet to be able to get the effect i'm looking for.
I've made a gif to better explain what i'm trying to do. I'm honestly not sure how to do it.
(My guess is something with stencils and shaders but other than that I don't know how to actually do it)
Re: Applying a textured overlay
Posted: Tue Oct 20, 2015 11:32 pm
by Evine
I did something like this for my ludum dare 32
http://evine.itch.io/iamtrojanhorse
I basically just have a large "image/texture" drawn over the entire screen.
The texture was converted to black/white and then converted that to black/transparent.
Re: Applying a textured overlay
Posted: Tue Oct 20, 2015 11:39 pm
by slime
Defender Vex wrote:i'm wanting to keep the texture static and making it look like the sprites are moving along it while being textured by it.
You might be able to get away with just drawing a fabric image (potentially with low opacity) after everything else, making sure it covers the entire screen. If the image is smaller than the screen you could use a [wiki]Quad[/wiki] and the 'repeat' [wiki]WrapMode[/wiki] to make it tile across the screen.
Re: Applying a textured overlay
Posted: Fri Oct 23, 2015 1:15 am
by Madrayken
Silly performance question. Do people think it would be quicker to do 2x overdraw, or to draw everything once using a more complex combo blend pixel shader that takes a 'pattern' texture as a parameter? I know it largely depends on device, but I'm still interested.