Jump to content

Apply Filter only to small area


DeusX
 Share

Recommended Posts

Hello,

I'm currently working on a little game with and Island and some (right now static) water, I was looking online for water-effects and found this, simple Article

https://markhawkinsdesigns.com/blog/web-design/working-with-pixijs-v4-and-the-displacementfilter/

I really like that effect but how do I restrict the area so that some of the image (especially the borders of the image, they look weird) stays uneffected, right now it looks a bit like wet paper instead of water. I tried using masking but that doesn't really help because now we have the same Image in the background but the edges of the foreground are still moving.

Restricting filterArea and changing the padding doesn't really work also. My Goal right now is that the edges of the images stay static respectively uneffected by the filter.

Thanks.

Link to comment
Share on other sites

Stupid workaround: try put neutral gray (0x808080) on the border of your displacement texture.

As for "apply filter only to part of object" general approach, its called "filter backdrop" and several implementations wer rejected by pixijs team because "its a rare case that should be in a plugin" or something like that.

Here was the demo that worked with displacementFilter:  https://github.com/pixijs/pixi.js/pull/4686 click on "jsFiddle" , but you have to apply those old changes to newer pixi.js version. 

I wanted to add it to my "pixi-picture" plugin, but, so far, no one asked me to do it :) Are you sure you need this general approach to be implemented, or border solution is enough for you?

Link to comment
Share on other sites

So, your workaround is to just put a grey frame around the texture with gimp or something? Haven't thought of that yet lol, I will try that solution tomorrow and provide Feedback.

Your general solution would be nice I think as this should be a rather common problem I suppose. I will take a look at your fiddle after trying the border solution.

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...