Agen0 Posted May 26, 2022 Share Posted May 26, 2022 Hi! I have been working on a particle simulator with gravity and a grid. Currently it looks like this: I was thinking of adding a gravitational space-time like bending effect. It seemed like the BulgePinchFilter filter, that comes with the pixi-filters package could be a good solution for this. So I made it such that this pinch effect is applied on the grid at every particles position. The more mass the particle has the more it should bend as well. The result looks more or less what I expected: It does get blurry when there is a lot of gravity, but I suppose its because the pixels are just getting stretched out, fair enough. The real problem, though, starts when this effect happens near the edge of the screen, like this: As you can see it is not actually bending things into view from outside of the viewport, but instead stretching the pixels at the edge of the screen. To emphasize this effect even more this is what happens when a line happens to be right at the edge: Could this be related to the autoFit property on each filter? When I turn that off for each of the pinch points everything gets very slow and the effect seems messed up - bending positions and strengths are wrong and the grid disappears when I zoom in. In other words I have no idea what I am doing with that, but it might be related. Does anyone know of any efficient and simple solution though? Is there some way to add some sort of padding to the edges of the view so that the bending filter would "know about" graphics outside the view so it could bend it into view? Any help would be welcome. This one has been bugging be for a while. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 27, 2022 Share Posted May 27, 2022 autoFit=false, specify filterArea a bit bigger than screen Rectangle(-w, -w, width + w*2, height + h*2) you read article about filters, right? https://github.com/pixijs/pixijs/wiki/v5-Creating-filters Agen0 1 Quote Link to comment Share on other sites More sharing options...
Agen0 Posted May 30, 2022 Author Share Posted May 30, 2022 Yep, I think this is what I was looking for. Thanks for taking the time to help out. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.