d13

Displacement map question..

Recommended Posts

Hi Everyone!

I have a general question about displacement maps in v5. I've noticed that when the displacementSprite is added to the container, the effect scales to the entire container size, rather than just being constrained to the size of the sprite. Just checking whether is the the actual current behaviour or if I might be implementing it incorrectly? 

I did notice this post on using bounds to constraining the size of the effect, which works, but it also masks the rest of the sprites in the container: 

 

Cheers!

Share this post


Link to post
Share on other sites

I dont actually remember whether scale is in normalized coords or pixel coords.

https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters

There are two ways we can solve that:

1. You wait for me to solve it

2. You learn about filter coordinate spaces, and why  DisplacementFilter needs extra sprite and not just a texture.

There's also the matter of "pixi-picture" plugin, i still didnt port it to v5, but it basically gives you ability to apply filter to background!

DisplacementFilter is one of strongest selling points, we have to make it better!

Edited by ivan.popelyshev

Share this post


Link to post
Share on other sites

It is out-of-the-box :) Whats the problem?

I just didnt understand what you want to do and assumed we have problem with scaling

Ah, thanks Ivan!! I love the "Wait for you to solve it" solution ;)

I write it to encourage people to solve everything themselves. Its a bitter option.

Edited by ivan.popelyshev

Share this post


Link to post
Share on other sites

My problem has been that the displamentFilter effect hasn't been scaling to the size of the displacementSprite, it's been scaling to the size of the entire container that the filter is added to.

I'm probably doing something wrong! I will check my code and report back :)

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.