Unmoving plaid effect

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
User avatar
tuupakku
Prole
Posts: 21
Joined: Fri Feb 12, 2016 12:12 pm

Unmoving plaid effect

Post by tuupakku » Sun Feb 14, 2016 11:51 am

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.

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Unmoving plaid effect

Post by davisdude » Sun Feb 14, 2016 1:17 pm

I'm not sure how you would do it, but this game does that. I think you use stencils IIR.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim

User avatar
pgimeno
Party member
Posts: 1908
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: Unmoving plaid effect

Post by pgimeno » Sun Feb 14, 2016 1:28 pm

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.)
Attachments
unmoving-shader.love
(8.21 KiB) Downloaded 47 times
unmoving-alpha.love
(20.18 KiB) Downloaded 35 times

User avatar
tuupakku
Prole
Posts: 21
Joined: Fri Feb 12, 2016 12:12 pm

Re: Unmoving plaid effect

Post by tuupakku » Sun Feb 14, 2016 1:55 pm

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.

User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Unmoving plaid effect

Post by s-ol » Sun Feb 14, 2016 2:15 pm

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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end

User avatar
pgimeno
Party member
Posts: 1908
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

Re: Unmoving plaid effect

Post by pgimeno » Sun Feb 14, 2016 2:20 pm

Re shaders, I learned with the blog: http://blogs.love2d.org/content/beginners-guide-shaders - it's an excellent introduction.

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 6 guests