pixijs / filters

Collection of community-authored custom display filters for PixiJS
https://pixijs.io/filters/docs/
MIT License
946 stars 160 forks source link

Bug: Unable to static render filter after prepare #313

Open kareljuricka opened 2 years ago

kareljuricka commented 2 years ago

I'm not sure, what I'm doing wrong but I can't get any custom filter to work. Build-in filters work correctly.

Link to reproduce: https://stackblitz.com/edit/typescript-qu4egd?file=index.ts

No errors in console..

Thanks for any advice..

bigtimebuddy commented 2 years ago

Adding a Ticker fixes the problem or using Renderer's prepare plugin. Even though your image is downloaded (with onload), it needs to be uploaded to the GPU, which can take about frame or so.

Use Ticker

const ticker = new PIXI.Ticker();
ticker.add(() => renderer.render(container));

Use Prepare


renderer.plugins.prepare.upload(sprite, () => {
    renderer.render(container);
});
kareljuricka commented 2 years ago

@bigtimebuddy thanks for tips

I don't like Ticker solution due to need to start a Ticker timer. So I tried to make it work with prepare solution, but with no luck. I updated stackbliz, please look if you can help me with what I'm doing wrong. Callback is called but nothing is rendered.. https://stackblitz.com/edit/typescript-qu4egd?file=index.ts

bigtimebuddy commented 2 years ago

Call render once before doing the upload. I this this maybe a bug, but I'll look into it.