Applying a textured overlay

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Defender Vex
Prole
Posts: 2
Joined: Tue Oct 20, 2015 8:45 pm

Applying a textured overlay

Post 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 :)
User avatar
DeltaF1
Citizen
Posts: 64
Joined: Mon Apr 27, 2015 4:12 pm
Location: The Bottom of the Stack
Contact:

Re: Applying a textured overlay

Post 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]?
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Applying a textured overlay

Post by bobbyjones »

You can also use a shader to give the look you want.
Defender Vex
Prole
Posts: 2
Joined: Tue Oct 20, 2015 8:45 pm

Re: Applying a textured overlay

Post 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)

Image
User avatar
Evine
Citizen
Posts: 72
Joined: Wed May 28, 2014 11:46 pm

Re: Applying a textured overlay

Post 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.
Artal, A .PSD loader: https://github.com/EvineDev/Artal
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Applying a textured overlay

Post 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.
User avatar
Madrayken
Party member
Posts: 126
Joined: Sun May 04, 2014 4:21 pm
Location: Oakland CA
Contact:

Re: Applying a textured overlay

Post 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.
Discord: https://discord.gg/tYfHgXc
Bandcamp: https://madrayken.bandcamp.com/
Twitter: @Fluttermind
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 7 guests