Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior of filters with center/offset property on moving objects #304

Open
4ian opened this issue Aug 17, 2021 · 1 comment
Open

Behavior of filters with center/offset property on moving objects #304

4ian opened this issue Aug 17, 2021 · 1 comment

Comments

@4ian
Copy link

4ian commented Aug 17, 2021

Hi!

I have some questions about what seems to be inconsistent behavior between a few filters - though I can't be sure if it's working as intended or not.
See this jsfiddle: https://jsfiddle.net/a17oxf92/ - this should be using latest PixiJS and latest filter versions.

  • The first filter "Twist" is not following at all the Sprite that is moving on the screen. This means that the "center of the twist" is always at the specified position relative to the screen. Intuitively, the center would be in the local object coordinates and would move along with the object (so you would not see any change to the rendered object, it would always be "twisted in the same way", just moving horizontally). I see that the property for this filter is called offset and not center so this may be on purpose?
  • The second filter "Radial blur" is properly following the Sprite that is moving, but up to a point.
    • If the sprite goes to the right, it's not changing. If it's going "too much" to the right, it's starting to change a bit (see the black areas appearing on the bottom right):
      image

    • If the sprite goes to the left, the center is now staying fixed on the screen, not following the Sprite anymore (i.e: the radial blur is not centered anymore):
      image

  • The third filter "Zoom blur" is "working well" when going to the right (i.e: the Sprite is not changing) but when going too much to the left, it's starting to "drift" (a bit like the radial blur).

It would be helpful to understand if it's a misunderstanding from my side on these 3 filters. The "drifting" center of radial/zoom when going too much on the left sounds weird - and the behavior of the first filter offset was also a surprise.
Initially, my assumption was that any of these filters would give the same effect to the Sprite, even if the Sprite is moved on the screen.

Let me know!

@ivanpopelyshev
Copy link
Contributor

Nope, it means "center of filterArea" and filterArea depends on autoFit and many other things. Yes, this thing is wrong and we have to use different coordinates.

So, are you the hero who can fix all those filters according to my conversion functions? https://github.com/pixijs/pixijs/wiki/v5-Creating-filters#conversion-functions

btw, if you want those things to be applied on single sprite, its better to do it in mesh-shader: https://pixijs.io/examples/#/mesh-and-shaders/shadertoy-mesh.js

4ian added a commit to HarsimranVirk/GDevelop that referenced this issue Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants