Page 1 of 1

Unmoving plaid effect

Posted: Sun Feb 14, 2016 11:51 am
by tuupakku
I have been trying to achieve an unmoving plaid effect in LÖVE without much success for a while now. I was wondering how you guys would implement this.

In case you don't know what unmoving plaid is, think of the characters' clothing in Chowder or Stan in Monkey Island:

[youtube]https://youtu.be/O-qMkIn59VU?t=2m51s[/youtube]

It's basically a static background that is masked and only shown in a certain part of the scene, usually in characters' clothing.

Re: Unmoving plaid effect

Posted: Sun Feb 14, 2016 1:17 pm
by davisdude
I'm not sure how you would do it, but this game does that. I think you use stencils IIR.

Re: Unmoving plaid effect

Posted: Sun Feb 14, 2016 1:28 pm
by pgimeno
I can think of two ways. One is to put the unmoving image as background, and make the animation using alpha. The other is using a shader. The shader has the advantage that you can easily have two simultaneous unmoving plaids with different textures without overlapping.

(While I was writing this, davisdude gave another solution using stencils. That may work as well.)

Re: Unmoving plaid effect

Posted: Sun Feb 14, 2016 1:55 pm
by tuupakku
Thanks for the help, the shader solution seems to be the better one here, even though I have never used shaders before and they look scarily complex. I'll look up a guide on them and get over my fear haha.

Once again, thanks.

Re: Unmoving plaid effect

Posted: Sun Feb 14, 2016 2:15 pm
by s-ol
Now that I read this thread I wonder why I used the stencil method in the first place (game linked above is mine). By just sampling the texture using the screen coordinates things are pretty simple and all the transforms are much easier too.

Re: Unmoving plaid effect

Posted: Sun Feb 14, 2016 2:20 pm
by pgimeno
Re shaders, I learned with the blog: http://blogs.love2d.org/content/beginners-guide-shaders - it's an excellent introduction.